Some common steps that Ajax application follows:
The figure below describes the structure of HTML pages and a sequence of actions in Ajax web application.:

Notice the three elements in the HTML page:
· The handEvent() JavaScript method,this method is used to handle events of a special HTML element
· XMLHttpRequest is an object supported by the web browser and runs as web client
· XML message - message transferred between XMLHttpRequest object and web server is under XML format
Ajax web application follows the sequential steps below; the actions are also mapped from the above figure:
1. The JavaScript function handEvent()t will be invoked when having an event occurred on the HTML element.
2. In the handEvent() method,an instance of XMLHttpRequest object is created.
3. The XMLHttpRequest object organizes an xml message within about the status of the HTML page,and then sends it to the web server.
4. After sending the request,the XMLHttpRequest object listens to the message from the web server
5. The XMLHttpRequest object parses the message returned from the web server and updates it into the DOM object
For a demonstration of the steps,a code example is presented in the next section.
|