Help, I'm confused.
I just need to get a JSON object into my page. The URL is as follows:
http://disqus.com/api/get_forum_posts/?user_api_key=MYKEY&forum_id=MYID&api_version=1.1
If I use the Flickr API URL and the code given in the getJSON example, it works fine:
<script>$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?",
function(data){
alert(data);
$.each(data.items, function(i,item){
$("<img/>").attr("src", item.media.m).appendTo("#images");
if ( i == 3 ) return false;
});
});</script>
But, if I substitute in the Disqus URL above, the data is null. After reading http://stackoverflow.com/questions/2429834/json-feed-returning-null-while-using-jquery-getjson I checked whether this URL returned valid JSON, and it does.
The Disqus API seems to suggest it supports JSONP - 'You can also pass "jsonp:callback" as the "api_response_format" parameter'. I've tried adding this parameter, but it doesn't help.
What am I doing wrong? I suspect the problem may be that I don't really understand the difference between JSON and JSONP, and what I need to be doing to get JSONP back.