I have a simple website with jQuery (1.8.2) doing an ajax call:
$.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);
}
});
The webpage has the headers:
Access-Control-Allow-Origin *
Access-Control-Expose-Headers Access-Control-Allow-Origin
Access-Control-Allow-Headers *
the ajax being return’d is:
[{"a":"b"}]
(which also passes JSONlint), The json is being served as application/json
However I get a parse error:
'error'
[object]
'parsererror'
Error
arguments: undefined
get stack: function () { [native code] }
message: "jQuery18209882410678546876_1355861965752 was not called"
set stack: function () { [native code] }
type: undefined
You will have to return
and not just the JSON, because with JSONP jQuery expects to get back executable script code.