Prevent Unhandled jQuery AJAX Error [duplicate]

AFAIK you cannot make the red thingies go away, when returning error status-codes (4xx, 5xx). They are used by the browser to indicate that something might have not gone as expected. Still these are mere decorations, since 4xx and 5xx status codes are perfectly valid, so I don’t see a reason for you wanting to eliminate them.

As you said yourself, your other alternative would be sending “200 responses from server with an additional argument that show that this is an error or a success result“.

I certainly recommend using the 4xx and 5xx codes though (that’s what they are designed for) and stop worrying about browser’s heads-up warnings in developer console (aka red thingies).

See also this and this questions that refer to similar errors when fetching other kinds of resources (images, files etc). The errors you see are actually of the same nature.

Leave a Comment