Xmlhttp is hot these, with the advent of AJAX.Xmlhttp is mainly used on the client-side to query or fetch blocks of data from the server.A typical example would be when in a sign up form the user selects the country the states for the selected country is automatically populated in the state dropdown.
Xmlhttp has two modes of operation, synchronous and asynchronous. In the synchronous mode,the browser window is locked till the operation is complete, as a result the user has to wait for the operation to complete even to scroll up/down the page, in contrast to synchronous mode synchronous mode is more preffered because, it works in background with affecting the other functions of the browser.
The example code below shows how to create the Xmlhttp object:
.open(string method,string url,bool async) /* opens the connection to the server */
.send(data) /* sends data */
The HTTP request methods supported are:
The object member variables:
.status /* holds teh status retured by ther server. e.g. 200,500,404 etc. */
.readyState /* the state of the operation e.g. 4=operation complete */
.responseText /* holds the text received from the request */
.responseXML /* in case the server returns XML this holds the XML data */
A simple example:
|All times are GMT +5.5. The time now is 06:02.|