[英]jQuery AJAX JSON parseerror
I've got a webpage with an AJAX request using jQuery and dataType=json 我有一个使用jQuery和dataType = json进行AJAX请求的网页
$.ajax({
type: "POST",
url: 'api/',
data: post,
success: function(data) {}
dataType: 'json',
error: function(jqXHR, textStatus, errorThrown) {
var message = myprint(errorThrown)+myprint(textStatus)+myprint(jqXHR);
// myprint is a custom print function
alert(message);
}
}
About 1% of the time, I got this alert : 大约有1%的时间,我收到此警报:
{}
"parsererror"
{
"readyState": 4,
"responseText": "{\"results\":[\"TEST1\",\"TEST2\"],\"time\":\"0,123\"}",
"status": 200,
"statusText": "OK"
}
Clearly there is no parseerror. 显然没有parseerror。 Do you have any idea that I might check ? 你有什么想法我可以检查吗? Thank you. 谢谢。
Error: "showing-json parse error" that mean: data format response from server incorrect
. 错误:“ showing-json解析错误”表示: data format response from server incorrect
。
In client, you set dataType is 'json' but into data response is not json data or may be xml (i not sure, you should check again). 在客户端中,您将dataType设置为'json',但进入数据响应的不是json数据,也可能是xml(我不确定,应该再次检查)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.