ajax所包含的技术(The technology that ajax contains)
ajax所包含的技术(The technology that ajax contains)
The technologies contained in AJAX
As you all know, AJAX is not a new technology, but a combination of several existing technologies. It is made up of the following techniques.
1. use CSS and XHTML to represent.
2. use the DOM model to interactively and dynamically display.
3. use XMLHttpRequest to communicate asynchronously with the server.
4. use JavaScript to bind and call.
In the above technology, in addition to the XmlHttpRequest object, all other techniques are based on the web standard and has been widely used in XMLHttpRequest, although not currently adopted by the W3C, but it is already a fact, because at present almost all mainstream browsers support it.
Ajax principles and XmlHttpRequest objects
The Ajax principle simply sends asynchronous requests to the server through the XmlHttpRequest object, gets data from the server, and then updates the page using JavaScript to manipulate the DOM. The most critical step is to get the request data from the server. To understand the process and principles, we must know something about XMLHttpRequest.
XMLHttpRequest is the core mechanism of Ajax, first introduced in IE5, and is a technology that supports asynchronous requests. Simply put, that is, JavaScript can request and process responses to the server in time without blocking users. Achieve no refresh effect.
So let's start with XMLHttpRequest and see how it works.
First of all, let's take a look at the properties of the XMLHttpRequest object.
Its attributes are:
Onreadystatechange event handler that triggers events for each change of status.
ResponseText returns the string form of data from the server process.
ResponseXML the DOM compatible document data object returned from the server process.
Status returns numeric code from the server, such as the common 404 (not found) and 200 (ready)
Status Text string information accompanying the status code
ReadyState object status value
0 (uninitialized) the object has been es