When it comes to handling all ajax requests and specifically dealing with 409 errors, I am facing an issue where my status code always shows as 0, despite FireFox's debugger clearly indicating a 409 error. Below is the snippet of JS code I have been using:
(function(open) {
XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
if(this.status === 409)
console.log("Conflict 409")
open.apply(this, arguments);
};
})(XMLHttpRequest.prototype.open);
Even though I can easily create 409 errors in my server code and see them being displayed in both FireFox and Chrome, the this.status
property remains at 0 - even for 400 errors. Can someone please guide me on what might be going wrong here?