Reputation: 23615
i have a working example which uses this url
http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=jQuery16201154390876987067_1314382298849&tags=cat&tagmode=any&format=json&_=1314382298856
which gives me this json result (this is the beginning of it:)
jQuery162031768042474373037_1314374838725({
"title": "Recent Uploads tagged cat",
"link": "http://www.flickr.com/photos/tags/cat/",
When i paste this in jslint, it says it is not valid json
now i have my own json service, which returns this:
{
"one0": "file201101_01.jpg ",
"one1": "file201101_02.jpg ",
"one2": "file201101_03.jpg ",
"one3": "file201101_04.jpg "
}
which is valid json according to jslint.
now the first (seems to be invalid) one is read by jquery.getJSON, but mine (which seems to be valid) isn't.
when i look in firebug, it 'says' that no content is returnd from my service, but the url shown is returning content when i copy-paste it in the browser.
This is my code:
$.getJSON("http://jadieda.com/myservice.php",
{ year: "2011",
id : "1"
},
function(data)
{
alert(data);
});
the alert(data) doesn't go off, so my guess was that the calling of the service did not return valid json (because of this from the help:As of jQuery 1.4, if the JSON file contains a syntax error, the request will usually fail silently)
Upvotes: 2
Views: 732