When running the code
$.getJSON('http://api.stackoverflow.com/0.8/questions/4', function(data) {
// Do some stuff here....
});
I get the error
Failed to load resource
Am I accessing this wrong?
When running the code
$.getJSON('http://api.stackoverflow.com/0.8/questions/4', function(data) {
// Do some stuff here....
});
I get the error
Failed to load resource
Am I accessing this wrong?
I suspect your problem (as I commented) is XSS related.
Try using JSONP instead of raw JSON; we just added support for the jsonp
parameter.
jsonp
parameter be added to the global parameters list here stackapps.com/questions/1/api-documentation-and-help
Commented
May 27, 2010 at 19:52
As Kevin says, XSS. Try this instead:
$.getJSON("http://api.stackoverflow.com/0.8/stats?jsonp=?", function(data){
alert(data.statistics[0]['total_questions']);
});