I'm experiencing something odd here, that I don't recall ever running into. I'm doing a normal $.ajax call to my server (codeigniter backend) and if some resource isn't found, I'm returning some error message along with a 404 header. jQuery recognizes that an error has occurred and runs the proper error callbacks. The issue is that it also throws a js exception in the browser, so firebug will complain (or whatever js console the browser might be using). Is this a new behavior? I don't recall jquery throwing a js error when a 404 header is returned. Relevant code below:
$.extend({
gallery: function (url, data) {
//send a request to an arbitrary url with some data. Expects to
//get json returned.
return $.ajax(State.url + url, $.extend({
dataType: 'json',
type: 'post'
}, data));
}
});
Above is my global ajax function I use in my app. I've tried various flavors of an error functions in that function but to no avail, I always get a js error thrown in firebug. Any ideas? The actual js error I'm getting is:
NetworkError: 404 Not Found
This is your console feature, not some jQuery gotcha. Try fiddling with your console options. Even Google Chrome tells that XHR failed or something like that.
P.S: Never used firebug. But it must be something in there only.
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