ajax| Refresh | page
Have you ever remembered that the internet was called "World Wide Wait" by users? Has the web returned to the Neolithic age? In many applications, the Web still hasn't changed much. Filled with form, button, page transfer, wait, page refresh, correct error, click, wait ... That's a tough enough.
Many of today's websites, such as many well-designed websites, have been greatly improved. More user responses are required so that the browser will not be responsive until the server has finished processing. For example, Google Map works like this: Customers have the opportunity to cache all the information, so that when users move maps, zoom in and other activities, they no longer need and the server for tedious and slow data interaction.
Ajax is the abbreviation for asynchronous JavaScript and XML. Mainly by a group of people more familiar with the formation of the technology:
JavaScript: scripting language ...
An object in the Xmlhttprequest:javascript that can communicate over the HTTP protocol and the server. Many of the tricks of Ajax are implemented through this object, and all major browsers, such as Mozilla Firefox, Internet Explorer 5, Safari, Opera 7.6, support this object.
Extensible Markup Language (XML):
XMLHttpRequest can communicate using XML files and servers.
HTML CSS:
Document Object Model DOM:
Xslt:
Ajax can be said to be not a new technology, but a reuse of existing technologies. Focus on the XMLHttpRequest object: This object can get data from the server, and users can easily use the data. The object has its own API:
Table 1-1. XMLHttpRequest Property
Property name |
Type/Description |
onReadyStateChange |
callback function; Set this property to the function that will be called. |
ReadyState |
Digital 0 indicates no initialization and the open () function is not invoked; 1 means load, the Send () function is not invoked; 2 means loaded, send () has been invoked, and Headers/status is available; 3 Interactive, ResponseText holding part of the data; 4 indicates completion. |
ResponseText |
string; The normal text returned. Responsexmldom Document object; An XML return value. Status code, for example, (OK) 404 (does not exist) for the status response. |
StatusText |
String The text associated with the HTTP response state. |
Table 1-2. XMLHttpRequest Method Method Name return value/description
Abort () |
void Cancels the HTTP request. |
getAllResponseHeaders () |
String Return all the corresponding headers |
getResponseHeader (string header) |
String Returns the value of the specified head information |
Open (String url,string asynch) |
void Prepares for HTTP requests and specifies whether to synchronize |
Send (String) |
void Sends an HTTP request. |
SetHeader (string header,string value) |
void Set the request header, but you must first call the Open function |
<