What are the possible values ​​for `jqXHR.status`?

What are the possible meanings for jqXHR.status

?

So far I see the following:

if (jqXHR.status === 0) { msg = 'Network Problem'; }
else if (jqXHR.status == 404) { msg = 'Requested page not found. [404]'; }
else if (jqXHR.status == 500) { msg = 'Internal Server Error [500].'; }

      

+3


source to share


2 answers


Anything can be here.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html



The value status

is the HTTP protocol status field that HTTP servers send in response.

Note that in this article, the jquery ajax documentation indicates that it is status

deprecated and you should use the statusCode

.

+6


source


According to the jQuery API Documentation :

For backward compatibility, the XMLHttpRequest

object jqXHR

will display the following properties and methods:

(...)

  • status

  • statusText



Then you can read more about the property XMLHttpRequest

on the WHATWG Living Standard page or on the MDN or W3Schools page . The latter also provides a link to a list of HTTP status messages .

Note that it jqXHR

also provides an attribute XMLHttpRequest

statusText

that can be used for quick and helpful error reporting in addition to the status code.

0


source







All Articles