简体   繁体   English

AJAX返回200成功,但无法解析响应JSON

[英]AJAX returning 200 success but failing to parse response JSON

I am getting an error with a jQuery AJAX call returning a 200 success code and a parseerror on the response. jQuery AJAX调用返回200成功代码和响应上的parseerror时出现错误。 I'm assuming this means jQuery got the data but couldn't parse it. 我假设这意味着jQuery得到了数据但无法解析它。 However, I can retrieve the response data and it is well-formed JSON. 但是,我可以检索响应数据,它是格式正确的JSON。

I am using jsonp data for cross-domain service. 我正在使用jsonp数据进行跨域服务。

jQuery jQuery的

jQuery.ajax({
    url: ServiceBasePath + "/json/ZipRiders",
    dataType: "jsonp",
    success: function (data) {
        ...
    },
    error: function (a,b,c) {
        alert(a, b, c);
    }
});

Error Data 错误数据

a:  Object { readyState=4, status=200, statusText="success", more...}
b:  "parsererror"
c:  Error: jQuery1101020726428059127155_1377610175566 was not called

Response 响应

[
  {
    "AdDescription": "Taking 75 north instead of 23 just for fun",
    "AdID": "---",
    "CityName": "Highland",
    "IsWanted": false,
    "Latitude": "42.656281",
    "Longitude": "-83.63297",
    "Name": "Ride to Milford, MI",
    "NetworkLogon": "---",
    "RideNotifyEnable": true,
    "UserName": "---"
  },
  {
    "AdDescription": "Ride to jackson",
    "AdID": "---",
    "CityName": "Jackson",
    "IsWanted": false,
    "Latitude": "42.252268",
    "Longitude": "-84.38842",
    "Name": "Ride to Jackson, MI",
    "NetworkLogon": "---",
    "RideNotifyEnable": true,
    "UserName": "---"
  },
  {
      ...
  },
  {
      ...
  },
  ...
]

The remote server does not seem to have recognized your jsonp callback. 远程服务器似乎无法识别您的jsonp回调。 Are you communicating with a jsonp-enabled API? 您是否正在与启用jsonp的API通信?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM