AJAX返回200成功,但未能解析响应JSON

时间:2013-08-27 13:37:29

标签: javascript jquery ajax json jsonp

我在jQuery AJAX调用时收到错误,在响应中返回200个成功代码和一个parseerror。我假设这意味着jQuery获取数据但无法解析它。但是,我可以检索响应数据,它是格式良好的JSON。

我正在使用jsonp数据进行跨域服务。

的jQuery

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

错误数据

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

响应

[
  {
    "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": "---"
  },
  {
      ...
  },
  {
      ...
  },
  ...
]

1 个答案:

答案 0 :(得分:1)

远程服务器似乎没有识别出你的jsonp回调。您是否正在使用支持jsonp的API进行通信?