View Full Version : Parse Error from - Ext.util.JSONP

28 Oct 2010, 7:02 AM
I am getting a 'Parse Error' on the JSON in returned reponse from the following code.

I ran the response result through JSON Lint - okay valid.

Using safari 5.0.2 on Win - iPad seems to fail similar. I never get to the .unmask()

Thanks for your help.

url: "http://odata.netflix.com/Catalog/Titles",
callbackKey: 'callback',
params: {
$filter:"Name eq 'The Name of The Rose'",
failure: function(response, opts) {
console.log('Server error ' + response.status);
callback: function(response) {
var video = response;

30 Oct 2010, 8:21 AM

I am continuing to have this problem. I simplyfied to using an edited version of examples/ajax - which reads in the test.json file found in ajax folder. I get result data, but with same parse error after 1st line of JSON. I am obviously missing something obvious.

Code frag & errors below.
Any help?

var makeJSONPRequest = function() {
Ext.getBody().mask('Loading...', 'x-mask-loading', false);
url: 'test.json',
callbackKey: 'callback',

callback: function(result) {
var weather = result;

Safari reports:

Resource interpreted as script but transferred with MIME type application/json.
test.json:2 (http://www.flicks-now.com/mdev/examples/ajax/test.json?callback=Ext.util.JSONP.callback)SyntaxError: Parse error

31 Oct 2010, 12:44 AM
Well, the error indicates it can't parse the JSON. I'm guessing that your server isn't returning data wrapped in a function, which JSONP requires. I suggest you do some reading: http://en.wikipedia.org/wiki/JSON#JSONP

31 Oct 2010, 8:52 AM
Got it. Thanks !