Common Ajax Properties and methods:
Property:
readystate:0 (Start creating Ajax object) 1 (call the Open method) 2 (call the Send method) 3 (returning data) 4 (return Data end)
Responsetext/responsexml: Accept Server return information
Onreadystatechange:ajax state readystate is changed to trigger the event to run
status:200/404
Method:
Open (Request method, request address, synchronous asynchronous flag): Create a new HTTP request
Send (): Sends an HTTP request
setRequestHeader (): Set HTTP Header protocol information
Get and POST request considerations:
(1) Get pass data directly in URL, post in Send method
(2) When passing Chinese information, get needs to encode Chinese and post does not need
(3) When the POST request, you can also pass the Get parameter information, on the server side can use $_get accept
Synchronous and Asynchronous differences:
Synchronization is blocking, an IO request can not be done before the next, asynchronous is non-blocking, the embodiment of the form is open (request, address,true asynchronous/false synchronization )
Cache processing:
(1) Add random numbers after the request address to ensure that each request is new
(2) on the server side to the PHP program set header information, prevent the browser to cache the current page
The basic point of Ajax in "Ajax" PHP