$.ajax({
type: "post",
url: "Handler.aspx/Val",
contentType: "application/json",
data:'{account:'+v+'}',
dataType: "json",
success: function (data) {
alert(data.d+"success");
// Play with returned data in JSON format
},
error: function (msg) {
alert(msg+"error");
}
解決方案 data:'{account:"'+v+'"}',
注意data必須是一個“表示JSON對象的字符串”,而不是一個“JSON”對象
原因是jquery會把JSON對象序列化成標准POST的形式,ASP.NET WebService需要的是JSON格式的數據,所以必須把你的數據變成一個JSON樣子的字符串
