Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

What are the possible values for jqXHR.status?

So far, I can 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].'; }
like image 571
Nate Pet Avatar asked Mar 20 '12 18:03

Nate Pet


People also ask

What does jqXHR stand for?

The jqXHR (jQuery XMLHttpRequest) replaces the browser native XMLHttpRequest object. jQuery wraps the browser native XMLHttpRequest object with a superset API. The jQuery XMLHttpRequest (jqXHR) object is returned by the $. ajax() function. The jqXHR object simulates native XHR functionality where possible.

Which method is used on the returned object of Ajax () method if the Ajax call fails?

If an AJAX request fails, you can react to the failure inside the callback function added via the fail() function of the object returned by the $. ajax() function. Here is a jQuery AJAX error handling example: var jqxhr = $.


1 Answers

It can be anything found here.

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

The status value is the HTTP protocol status field that http servers send on the response.

Note at this point, the jquery ajax documentation indicates that status is deprecated, and you should use statusCode instead.

like image 77
hvgotcodes Avatar answered Nov 15 '22 19:11

hvgotcodes