1. What is AJAX
(1) AJAX:"Asynchronous JavaScript and XML" in Chinese means: asynchronous JavaScript and XML, A web development technology that creates interactive Web applications. Ajax is not an acronym, but a noun created by Jesse James Guiett .
(2) not a single technology, but an organic use of a range of related technologies:Web Standards (standards-based presention) +xhtml+ the representation of CSS.
1 use Dom (Document Object Model) for dynamic display and interaction.
2 use XML and XSLT for data interaction and related operations.
3) using XMLHttpRequest for asynchronous data query, retrieval.
(3) simple to understand as:javascript+xmlhttprequest+css+ server-side collection.
2. Normal Web page request Receipt Process ( Request response Mode )
3. Ajax WEB Application Model
4. Ajax Benefits
(1) The essence of AJAX is a browser-side tip.
(2) The main purpose of Ajax technology is to locally exchange data between client and server.
(3) The main character of this technology is XMLHttpRequest , which is the ability to update the data without having to reload the entire page, which is called the refresh without Reload ( light Refresh ).
(4) communication with the server is achieved entirely through JavaScript .
(5) The amount of data transmitted using XMLHttpRequest itself is very small, so the reaction will be very fast, that is, make the network program more like a desktop application.
(6) Ajax is the use of JavaScript in the background secretly to help you go to the server for information, and finally have JavaScript or Dom to help you render the result, because all actions are made by JavaScript to do so, so that the inconvenience of Web page overload, users can not feel the pain of waiting.
5. XMLHttpRequest
(1) the center of the Ajax application is it.
(2) The XMLHttpRequest object is created differently in ie and non ie browsers.
(3) in short, it can read txt or XML data asynchronously from the server side .
(4) The creation method in ie and non ie is:
To create an asynchronous object based on the way a response is used by different browsers
The code is as follows |
Copy Code |
function Createxmlhttp () {
Xhobj = false;
try {
Xhobj = new ActiveXObject ("Msxml2.xmlhttp"); iemsxml3.0+
catch (e) {
try {
Xhobj = new ActiveXObject ("Microsoft.XMLHTTP"); iemsxml2.6
} catch (E2) {
Xhobj = false;
}
}
if (!xhobj && typeof xmlhttprequest!= ' undefined ') {//Firefox, Opera 8.0+, Safari, Google browser
Xhobj = new XMLHttpRequest ();
}
return xhobj;
} |