0

In jQuery, when an AJAX request fails due to an HTTP error (e.g., 500 Internal Server Error) what is the value of the textStatus argument to the error handler? E.g.,

$.ajax(...).fail(function(jqXHR, textStatus, errorThrown) {
    console.log(textStatus); // What is this when an HTTP error occurs?
});

The jQuery documentation for $.ajax() simply lists the possible values, but there is no clear explanation as to when they occur. Particularly, jQuery mentions:

When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error."

But it does not say what the value of textStatus will be.

Uyghur Lives Matter
  • 18,820
  • 42
  • 108
  • 144

1 Answers1

1

When you receive an HTTP error response (e.g., 500 Internal Server Error), the value of the textStatus argument will be "error". This was determined through testing.

Uyghur Lives Matter
  • 18,820
  • 42
  • 108
  • 144