|
|
::::::::::::::::::::::::::
|
|
:::::::::::::::::::::::::
|
|
|
|
Review Ajax
Use Ajax begins with the JavaScript-object named XMLHttpRequest. As well as assumes a name, he allows to carry out HTTP-searches in a client part of your code and analyzes the answer of the XML-server. A first step in studying Ajax - creation of the data of object XMLHttpRequest. A method of report HTTP at use for search (GET or POST) and ways then are established in object XMLHttpRequest.
Now recollect, why "?" in word Ajax designates "asynchronous"? When you send HTTP-search, you do not want, that the browser has hung, expecting the answer of the server. Instead of it you want to react also to action of the user on page and to work with the answer of the server when that finally will come. To execute it, you need to register function of callback with help XMLHttpRequest and to send asynchronously search XMLHttpRequest. The control remain behind a browser, and function of callback will be called, when the answer of the server will come.
On the Web-server the search will come the same as also any another HttpServletRequest. After the analysis of parameters of search, servlet will execute all necessary actions for the application, serializuet his{its} search in format XML and enters it{him} in HttpServletResponse.
Coming back to the client, the function of callback registered in XMLHttpRequest, now is carried out to process the XML-document returned by the server. At last, the user interface is updated according to the data of the server, using a JavaScript-code for transformation of page.
Now, when you have review Ajax of a high level, I rassmotrju it{him} in more details at each step. Look at figure 1 if you suddenly will forget sequence of studying which is indistinct owing to asynchronous nature Ajax.

|