Ajax Definition
Ajax is not a technology. It is actually several technologies, each of which has its own unique characteristics. Together, Ajax becomes a powerful new technology. Ajax includes:
XHTML and CSS
Use Document Object Model for Dynamic Display and Interaction
Use XML and XSLT for Data Interaction and operations
Use XMLHttpRequest for asynchronous data receiving
Bind them together using JavaScript
The traditional web application model works like this: Most user actions on the Interface trigger an HTTP request connected to the Web server.
The server completes some processing-receiving data, processing computing, accessing other database systems, and finally returning an HTML page to the client. This is an old model. It has been used as a web application since hypertext was used. But readers who have read The Elements of User Experience must know that, what makes Web interfaces easier to use than desktop software.
Figure 1: Comparison between the traditional Web application model (left) and the Ajax model (right ).
This old approach makes us realize many technologies, but it will not produce a good user experience. What are users doing when the server is processing their own tasks? That's right. Wait. Users have to wait for every action.
Obviously, if we design Web applications according to the thinking of desktop programs, we don't want users to wait. When the interface is loaded, why do users need to spend another half of their time retrieving data from the service? In fact, why do we always let users see the program to fetch data from the server?
How Ajax is extraordinary
By introducing an Ajax engine between the user and the server, you can eliminate the interaction process such as starting, stopping, starting, and stopping the Web. it is like adding a mechanism to the program to make it more responsive, and it does.
Unlike loading a page, the browser loads an Ajax engine at the beginning of a session-written in JavaScript and usually in a hidden frame. This engine is used to draw user interfaces and communicate with the server. The Ajax engine allows Asynchronous interaction between users and programs-without waiting for server communication. Therefore, you no longer need to open a blank window, and wait until the cursor continuously turns, and wait for the server to finish responding.
Figure 2: Comparison between synchronous interaction process (I) of traditional Web applications and Asynchronous interaction process of Ajax applications (II ).
The user action that usually generates an HTTP request is now replaced by calling the Ajax engine through JavaScript. the response of any user action is no longer required to be directly transmitted to the server-for example, simple data verification, data editing in the memory, or even some page navigation-the engine can process it by itself. if the engine needs to retrieve data from the server to respond to user actions-assuming that it submits the data to be processed, loads other interface code, or receives new data-the engine asynchronously performs these operations, XML is usually used to avoid mistaken User Interface interaction.