The AJAX full name is: asynchronous Javasctipt and Xml.
1. Why do I need ajax?
The general Web program interacts with the Server: the page sends the request waiting for the server to process, and the server processes the Data. The user page refreshes the entire page. Thus completing an Interaction.
It is assumed that such a synchronous way of interacting with the server multiple Times. Users will need a lot of time to wait for the server to Process.
The idea of Ajax asynchronous processing is that when a page sends a Request. Given to server processing, the same time that the server processes, the page does not have to wait for other operations, when the server is finished Processing. Displays the results on the current Page. No need to refresh the entire page.
Simple implementation of 2.ajax
Implementing AJAX requires the use of Javascript's XMLHttpRequest Object.
Implementation process
1) Create objects (different browsers have different methods of creation, generally need to consider IE and Non-ie browser)
IE browser to use the Activexobject.
Non-ie browsers can create a new XMLHttpRequest object instance Directly.
2) Send the Request.
You need to establish a connection to the server before sending the Request. The number of parameters it requires is the sending type, the URL of the connection, the asynchronous connection state value, and so On.
> Send type: get/post and so On.
> Url: Connection Address +? + Transferred value (+ & + Transferred value): ) [here is the Get method used]
> Asynchronous Connection Status Value: true/false. The default is True. True indicates an asynchronous Connection.
A return function is also established before sending the request, which is used to specify what to run after the server Response.
Send the Request.
3) Server response function
3. A simple example
<! DOCTYPE Html>
[ajax Learning notes] Ajax Preliminary interview