ajax| Essence
What is your browser doing when browsing the web in a browser when the page is slow to refresh? What is your screen content? Yes, your browser is waiting to refresh, and your screen content is blank, and you wait in front of the screen for the browser's response.
To overcome this embarrassment, the developer had to add a div to each page that might take a long time to respond, telling the user, "Please wait while the system is processing your request ...".
Now, there is an increasingly popular and hot "old" technology, can completely change this embarrassing situation. That's Ajax. Today, with Gmail, google-maps apps and various browsers, Ajax is attracting the world's attention.
One, Ajax definition
AJAX (Asynchronous JavaScript and XML) is actually a combination of multiple technologies, including JavaScript, XHTML and CSS, DOM, XML, and Xstl, XMLHttpRequest. which
Standardize rendering with XHTML and CSS, use DOM for dynamic display and interaction, data exchange and processing using XML and XSTL, asynchronous data reading with XMLHttpRequest objects, and use JavaScript to bind and process all data.
Before the AJAX proposed, the industry for the above technology is only a separate use, not integrated use, but also because of the previous technical needs of the decision. With a wide range of applications, Ajax has become a sweet pastry.
Ii. status quo and problems to be solved
The traditional Web application uses the synchronous interaction process, in which case the user first triggers an action or request call to the HTTP server. In turn, the server performs certain tasks and then returns an HTML page to the requesting user. This is an incoherent user experience, the server in processing requests, the user most of the time in the state of waiting, screen content is blank. The following figure:
Since the adoption of hypertext as a Web transmission and rendering, we have adopted such a set of transmission mode. When the load is relatively small, this does not reflect what is wrong. But when the load is relatively large, response time to be very long, 1 minutes, 2 minutes ... In a few minutes, the wait is intolerable. Serious, exceeding the response time, the server simply tells you that the page is not available. Also, sometimes I just want to change a small part of the page data, then why do I have to reload the entire page?! When software design becomes more and more human, such a bad user experience simply runs counter to this principle. Why do you always have to let the user wait for the server to fetch data? At the very least, we should reduce the time that users wait. Now, in addition to programming, coding optimization and server tuning, you can also use Ajax.
[1] [2] [3] Next page