What are the status values you need to deal with when working with AJAX

The XMLHttpRequest object has few properties
onreadystatechange: The event handler that fires at every state change, typically a call to a JavaScript function.
readyState: The state of the request. The five possible values are 0 = uninitialized, 1 = loading, 2 = loaded, 3 = interactive, and 4 = complete.
responseText: The response from the server as a string.
responseXML: The response from the server as XML. This object can be parsed and examined as a DOM object.
status: The HTTP status code from the server (that is, 200 for OK, 404 for Not Found, and so on).
statusText: The text version of the HTTP status code (that is, OK or Not Found, and so on).
Here is a example code which demonstrates how these atributes can be used
function doSomething() {
 //..do something here, like adding parameter values etc...
 xmlHttp.open("GET", url);
 xmlHttp.onreadystatechange = callback;
function callback() {
  if (xmlHttp.readyState == 4) {
    if (xmlHttp.status == 200) {
        //do you required work here
Notice the line 
xmlHttp.onreadystatechange = callback;
in doSomething method which is assigning a value as "callback" to the onreadystatechange attribute. 
The value is name of a method which called every time readystate of XMLHttpRequest object is changed.

AJAX request status, AJAX code example, AJAX code for checking status values of http request object, AJAX programming check of http request, working with request status in AJAX