How can you handle errors in a getJSON call? Im trying to reference a cross-domain script service using jsonp, how do you register an error method?
In some cases, you may run into a problem of synchronization with this method.
I wrote the callback call inside a setTimeout
function, and it worked synchronously just fine =)
E.G:
function obterJson(callback) {
jqxhr = $.getJSON(window.location.href + "js/data.json", function(data) {
setTimeout(function(){
callback(data);
},0);
}