I am making a jQuery Ajax call with the error option set. In my “error” method, I would like to handle HTTP 408 differently from regular HTTP 500.
The problem is that jxhr.statusCode is 0, and the value of “status” is just “error”! But in firebug, I see that the service definitely returned a 408 status code.
Why is jxhr.statusCode code 0? Is there any other way to identify HTTP 408 error?
My error handler code looks like this (for error 408, the code just continues in the 'else' block):
error: function (jxhr, status, error) { var $message = element.next().find('.loadmask-msg-label'); if (jxhr.status == 401) $message.html(settings.unauthorizedMessage); else if (jxhr.status == 408) $message.html(settings.timeoutMessage); else $message.html(settings.errorMessage);
source share