AJAX - HTTP Status Code


AJAX - HTTP Status Code

  • The readyState property indicates that the data loading process is started.
  • The probable values that can be applied for the readyState property are indicated below by the http ajax status codes :

- http ajax status code -   0 uninitialized

- http ajax status code -   1 loading

- http ajax status code -   2 loaded

- http ajax status code -   3 interactive

- http ajax status code -   4 complete

ajax programming examples - sample code  : 

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() 
    {
        if (xhttp.readyState == 4 && xhttp.status == 200) 
        {
            document.getElementById("text").innerHTML =   xhttp.responseText; 
        }
    };
  • The status property contains the status value of the download process. It is nothing but a standard http ajax status code that the browser acquires according to the supplied URL. 
  • The probable values that can be applied for the status property are indicated below by the http ajax status codes :

- http ajax status code -   200 OK

- http ajax status code -   201 Created

- http ajax status code -   204 Data not available

- http ajax status code -   205 Reset data

- http ajax status code -   206 Partial data

- http ajax status code -   400 Bad data Request

- http ajax status code -   401 Unauthorized access

- http ajax status code -   403 Forbidden request

- http ajax status code -   404 Not Found

- http ajax status code -   405 Method Not Permitted

- http ajax status code -   406 Not Acceptable

- http ajax status code -   407 Proxy Authentication Required and not available

- http ajax status code -   408 Request Timeout 

- http ajax status code -   411 Length Required and not available

- http ajax status code -   413 Requested Entity Too Large

- http ajax status code -   414 Requested URL Too Long

- http ajax status code -   415 Unsupported Media Type

- http ajax status code -   500 Internal Server Error

- http ajax status code -   501Not Implemented

- http ajax status code -   502 Bad Gateway

- http ajax status code -   503 Service Unavailable

- http ajax status code -   504 Gateway Timeout

- http ajax status code -   505 HTTP Version Not Supported

  • The following values of XMLHttpRequestObject’s readyState and status properties indicate that the download process has been finished without errors:

readyState = 4 and 

status property = 200