This is a brief outline of my code:
$.getJSON(json_url, function(data) {
// application logic
}).error(function() {
console.log("error");
});
The problem is that when the server returns a 404 error, it does not appear to be handled as there is no console.log()
saying error, but there is a GET request failure with a code of 404 (Not Found)
showing up in the console.
I am using jQuery 1.9.0.
Is there some simple error I am making?
Due to the nature of JSONP requests, the error callback is not called for those.
From the docs:
When data is retrieved from remote servers (which is only possible using the
script
orjsonp
data types), the error callbacks and global events will never be fired.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With