请帮助。在我的ajax调用收到错误无效的JSON原始的,什么是错这个下面Ajax调用
Please Help. In my ajax call getting error Invalid JSON primitive, whats wrong with this following ajax call
$.ajax({
url: "/Precedent/ShowPartyContents", type: "POST",
contentType: 'application/json; charset=utf-8',
dataType: 'html',
data:{'partyId':party,'PartySelCombo':valueFrom,'DocumentId':DocId},
sucess:function(result){
alert("String"+ result);
//jq("#PartyTagContentArea-"+ pass cheyyenda id).html(data).fadeIn();
},
error : function( ts ){
alert("error :(" + ts.responseText);
}
});
感谢
您是有希望的应用程序/ JSON
的内容类型,但是发送的是纯JS对象,它得到序列化为百分恩codeD-字符串的jQuery。这种序列化可能是远离有效的JSON。
You are promising a content type of application/json
but are sending a plain JS Object, which gets serialised as percentile-encoded-string by jQuery. This serialization might be far from valid JSON.
修改
data: {'partyId':party,'PartySelCombo':valueFrom,'DocumentId':DocId},
到
data: JSON.stringify({'partyId':party,'PartySelCombo':valueFrom,'DocumentId':DocId}),
上一篇:AJAX轮询频率 - 长轮询或不长轮询?不长、频率、AJAX、长轮询
下一篇:在IE中,该英寸×请求的,随着" jquery的报头变得英寸×请求的-与" (小写)报头、IE、jquery、QUOT