$.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样子的字符串
