[英]JQUERY JSON response triggers parse error
I am trying to perform some basic operations with jquery json. 我正在尝试使用jquery json执行一些基本操作。
var urlPath= encodeURIComponent('{"fields":"subject,course,unit,topic,lesson"}');
$.ajax({
url : 'http://abcd.org/proficiency.json?data'+urlpath,
type : 'GET',
dataType : 'jsonp',
contentType: "application/json",
success : function(data) {
console.log("success");
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log(XMLHttpRequest, textStatus, errorThrown);
}
});
The error callback is always triggers 错误回调始终是触发器
Error... parsererror jQuery15001997238997904205_1298484897373 was not called. 错误...未调用parsererror jQuery15001997238997904205_1298484897373。
How to fix it? 如何解决?
Thanks for reading.. 谢谢阅读..
The server is giving back invalid JSON, there is an extra }]
and a missing ,
. 服务器回馈无效JSON,有一个额外
}]
而遗漏的,
。 It should be changed to this: 应该更改为:
{
"content": [
{
"topic": [
{
"22920": 0.0003933333333333333
},
{
"22937": 0.14765555555555557
},
{
"22881": 0.0013955555555555555
}
]
}
],
"message": [],
"dateRange": [
{}
],
"paginate": {}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.