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?
This is quite an old thread, but it does come up in Google search, so I thought I would add a jQuery 3 answer using promises. This snippet also shows:
The code snippet is:
$.getJSON({
url: "https://myurl.com/api",
headers: { "Authorization": "Bearer " + user.access_token}
}).then().always( function (data, textStatus) {
$("#txtAPIStatus").html(data.status);
$("#txtAPIValue").html(data.responseText);
});