jQuery ajax()在json传递jsonlint时说parseerror

时间:2012-12-18 20:44:30

标签: jquery ajax json parsing

我有一个简单的网站,jQuery(1.8.2)正在进行ajax调用:

$.ajax({
  url: 'http://localhost:1337?callback=?',
  dataType: 'jsonp',
  crossDomain: true,
  success: function(a,b,c) {
    console.log('success',a,b,c);
  },
  error: function(a,b,c) {
    console.log('error',a,b,c);
  }
});

网页上有标题:

Access-Control-Allow-Origin *
Access-Control-Expose-Headers Access-Control-Allow-Origin
Access-Control-Allow-Headers *

返回的ajax是:

[{"a":"b"}]

(也传递JSONlint),json作为application/json

提供

但是我得到一个解析错误:

'error'
[object]
'parsererror'
Error
  arguments: undefined
  get stack: function () { [native code] }
  message: "jQuery18209882410678546876_1355861965752 was not called"
  set stack: function () { [native code] }
  type: undefined

0 个答案:

没有答案