javascript - Why do I keep getting an "undefined" error with this JSONP feed? -


i using following code retrieve data in jsonp format. need use if no data returned, can flag error. using jquery's ajax(), returns 404 pages being successful, need use jquery-jsonp jquery plug-in on google code error handling.

i borrowed code example on jquery ajax (jsonp) ignores timeout , doesn't fire error event, cannot seem work json, being sent mime type "application/json" other server.

$(function(){     var jsonfeed = "http://othersite.com/feed.json";      $.jsonp({         url: jsonfeed,         datatype: "jsonp",         timeout: 5000,         success: function(data, status){             $.each(data.items, function(i,item){                 console.log("title: " + item.title);                  if (i == 9) return false;             });         },         error: function(xhr, textstatus, errorthrown){             console.log("error status: " + textstatus);             console.log("error thrown: " + errorthrown);         }     }); }); 

here example of json:

[ { "title" : "my title" } ]

can spot problem?

are sure "othersite.com" supports jsonp. json cannot converted jsonp client. server needs support wrapping content callback function.


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -