In the following javascript, I would like to handle errors based on http error code. It is possible to handle all other types of http errors but not 407, when server sends the status as 407, jqXHR.status shows as "0" not "407". Any idea why it not shows status as 407? Is there any alternate approach to handle 407 errors in client side.
function handleError(jqXHR) {
if (jqXHR.status === 500) {
// Server side error
} else if (jqXHR.status === 404) {
// Not found
} else if (jqXHR.status === 407) {
// Proxy Authentication is required
// This is not working, when server send http status code as 407, client side it is recieved as 0
}
}