程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> ajax-AJAX POST 字符串(長度400左右的JSON格式字符串)出現字符串在後台接收時混亂

ajax-AJAX POST 字符串(長度400左右的JSON格式字符串)出現字符串在後台接收時混亂

編輯:編程綜合問答
AJAX POST 字符串(長度400左右的JSON格式字符串)出現字符串在後台接收時混亂

前端 是HTML,通過AJAX異步調用,
其中masterString是將JSON格式的數組轉換成string,(使用json2.js與自己寫的jsonToString)均有問題。
$.ajax({
url: "../Services/Service" + handletype + ".ashx",
type: "post",
dataType: "text",
data: "add=fl&result=" + masterString + "&encoded=" + encodeURIComponent(masterString),
async: true,
success: function (data) {}
});
後台是.NET寫的ashx的generic handler,後台捕獲數據時發現:
約5000次請求中會有1-2次數據異常,
key:add
value:fl
key:result
value:{"MasterID":"7","UserOpenID":"","QAList":[{"Q":"733","A":"2072"},{"Q":"734","A":"2076"},{"Q":"735","A":"2079"},{"Q":"736","A":"2082"},{"Q":"737","A":"2085"},{"Q":"738","A":"2088"},{"Q":"739","A":"2091"},{"Q":"740","A":"2094"},{"Q":"741","A":"2097"},{"Q":"742","A":"2099"},{"Q":"743","A":"2103"},{"Q":"744","{"Q":"747","A":"2114"},{"Q":"748","A":"2119"},{"Q":"749","A":"2122"},{"Q":"750","A":"2123"},{"Q":"751","A":"2128"},{"Q":"752","A":"2129"},{"Q":"753","A":"2134"},{"Q":"754","A":"2137"},{"Q":"755","A":"2138"},{"Q":"756","A":"2142"},{"Q":"757","A":"2144"},{"Q":"758","A":"2148"},{"Q":"759","A":"2150"},{"Q":"760","A":"2151"},{"Q":"761","A":"2154"},{"Q":"762","A":"2158"},{"Q":"763","A":"2163"},{"Q":"764","A":"2168"},{"Q":"765","A":"2173"}]}
key:encoded
value:{"MasterID":"7","UserOpenID":"","QAList":[{"Q":"733","A":"2072"},{"Q":"734","A":"2076"},{"Q":"735","A":"2079"},{"Q":"736","A":"2082"},{"Q":"737","A":"2085"},{"Q":"738","A":"2088"},{"Q":"739","A":"2091"},{"Q":"740","A":"2094"},{"Q":"741","A":"2097"},{"Q":"742","A":"2099"},{"Q":"743","A":"2103"},{"Q":"744","A":"2106"},{"Q":"745","A":"2109"},{"Q":"746","A":"2112"},{"Q":"747","A":"2114"},{"Q":"748","A":"2119"},{"Q":"749","A":"2122"},{"Q":"750","A":"2123"},{"Q":"751","A":"2128"},{"Q":"752","A":"2129"},{"Q":"753","A":"2134"},{"Q":"754","A":"2137"},{"Q":"755","A":"2138"},{"Q":"756","A":"2142"},{"Q":"757","A":"2144"},{"Q":"758","A":"2148"},{"Q":"759","A":"2150"},{"Q":"760","A":"2151"},{"Q":"761","A":"2154"},{"Q":"762","A":"2158"},{"Q":"763","A":"2163"},{"Q":"764","A":":"2163"},{"Q":"764","A":"2168"},{"Q":"765","A":"2173"}]}

發現:
不進行encode在Q744處出現異常(異常位置隨機,每次都不一樣。){"Q":"744","{"Q":"747","A":"2114"},encode部分在764處異常,"Q": "764","A": ":"2163"},

求各位大神幫忙支招。

最佳回答:


有時候數據還是這樣的

FORM DATA:
key:
value:FF�f�b'V7W�Gӷ"�7GV'�D"�"c"�"U7V'�V�D"�""�"Ė7G"���""�"cc�"�""�"�S#"�·""�"cs"�""�"�Sc"�·""�"cs"�""�"�c"�·""�"cs#"�""�"�c3"�·""�"cs3"�""�"�c�"�·""�"csC"�""�"�sC"�·""�"csS"�""�"�sS"�·""�"csc"�""�"�ss"�·""�"css"�""�"��"�·""�"cs�"�""�"��C"�·""�"cs�"�""�"���"�·""�"c�"�""�"��#"�·""�"c�"�""�"��s"�·""�"c�#"�""�"�"�·""�"c�3"�""�"�S"�·""�"c�C"�""�"��"�·""�"c�S"�""�"�#"�·""�"c�c"�""�"�S"�·""�"c�s"�""�"��"�·""�"c��"�""�"�#S"�·""�"c��"�""�"�#s"�·""�"c�"�""�"�3#"�·""�"c�"�""�"�3c"�·""�"c�#"�""�"�3�"�·""�"c�3"�""�"�Cc"�·""�"c�C"�""�"�Cs"�·""�"c�S"�""�"�S"�·""�"c�c"�""�"�SS"�·""�"c�s"�""�"�S�"�·""�"c��"�""�"�cS"���bV�6�FVF�Rs$R##�7GV'�DR##R3R##cR##R#4R##U7V'�V�DR##R3R##R##R#4R##Ė7GR##R3RS$Rs$R##R##R3R##cc�R##R#4R##R##R3R##�S#R##RsDR#4Rs$R##R##R3R##csR##R#4R##R##R3R##�ScR##RsDR#4Rs$R##R##R3R##csR##R#4R##R##R3R##�cR##RsDR#4Rs$R##R##R3R##cs#R##R#4R##R##R3R##863"},{"Q":"673","A":"1868"},{"Q":"674","A":"1874"},{"Q":"675","A":"1875"},{"Q":"676","A":"1877"},{"Q":"677","A":"1881"},{"Q":"678","A":"1884"},{"Q":"679","A":"1888"},{"Q":"680","A":"1892"},{"Q":"681","A":"1897"},{"Q":"682","A":"1901"},{"Q":"683","A":"1905"},{"Q":"684","A":"1908"},{"Q":"685","A":"1912"},{"Q":"686","A":"1915"},{"Q":"687","A":"1919"},{"Q":"688","A":"1925"},{"Q":"689","A":"1927"},{"Q":"690","A":"1932"},{"Q":"691","A":"1936"},{"Q":"692","A":"1939"},{"Q":"693","A":"1946"},{"Q":"694","A":"1947"},{"Q":"695","A":"1951"},{"Q":"696","A":"1955"},{"Q":"697","A":"1959"},{"Q":"698","A":"1965"}]}

值不能為 null。
參數名: input

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved