I’m trying to do a JSONP call to an api but I’m not sure if the API supports JSONP not sure how I can test for that. But below shows firebug console error which is invalid label. Does this mean the api does not support JSONP is this something wrong in my call.
Here is my call to the api. I changed the url because the client would not be happy of my giving out the url
jQuery.getJSON("http://blaa.blaa.com/api/services?format=js&callback=?",
function (data) {
console.log("services data = ", data);
});
When I test in firebug I get this
invalid label
{"services":{"service":[{"name":"tt"...
servic...2711124 (line 1, col 1)
Invalid labelis the error you will get when what you expect to be served as JSONP content (i.e. Javascript code) is in fact JSON content.This is not valid Javascript, even though it is a JSON object:
This is because the
{is treated as the opening of a block, rather than an object literal.'foo'is then treated as an attempt to create a label, where it is invalid to have the surrounding quote marks.This essentially functions as a cryptic message to tell you that the server doesn’t understand JSONP, or that you haven’t requested it properly (some servers ask for extra parameters beyond the standard
callback=).