This article mainly introduces the way of learning about Ajax, how to learn Ajax,ajax learning must be experienced. Now, let's take a look at this article.
Ajax (asynchronous JavaScript and XML)
You have to have JavaScript and Dom basics before you learn Ajax.
I. Introduction and Advantages of Ajax
A. What is Ajax?
Ajax adoption is an asynchronous interaction process
1. Local Refresh
2. Collect data on Demand
B. Advantages and disadvantages of Ajax
C. Application of Ajax
Second, create Ajax objects, this is the first step in learning Ajax
var request=new xmlhttprequest ();
var d=new Date ();
The process of creating objects is a bit more complicated, but the code is fixed
Writes the process of creating a XMLHttpRequest object to a function
The main reason is to divide the browser into two
One is IE series browser (IE5.0 IE5.5 IE6.0, IE7 IE8)
A non-IE browser (all based on the Internet standard) FF Mozilla NetScape (want to see more on the Topic.alibabacloud.comAJAX Development Manual section of the study)
Third, using the AJAX request server
Iv. getting the data sent by the server via Ajax
V. Creating AJAX classes to simplify the use of Ajax
Vi. example production of Ajax (unique checksum no refresh paging)
New ActiveXObject ("Microsoft.XMLHTTP");
New ActiveXObject ("MSXML. XMLHTTP ");
New ActiveXObject ("' msxml2.xmlhttp.7.0 '");
....
[' Microsoft.XMLHTTP ', ' MSXML. XMLHTTP ', ' msxml2.xmlhttp.7.0 ', ' msxml2.xmlhttp.6.0 ', ' msxml2.xmlhttp.5.0 ', ' msxml2.xmlhttp.4.0 ', ' MSXML2. xmlhttp.3.0 ', ' MSXML2. XMLHTTP ']
Methods in the Ajax engine object
Abort () Stop the current request
getAllResponseHeaders () returns the full headers as a string
getResponseHeader ("Headerlabel") returns a single header label as a string
Open ("Method", "URL" [, asyncflag[, "UserName" [, "Password"]]) set the target URL, method, and other parameters of the pending request
Send (content) request
setRequestHeader ("label", "value") sets the header and sends it with the request
Properties in the Ajax engine object
onReadyStateChange event triggers for state changes
ReadyState Object State (integer):
0 = uninitialized 1 = read in 2 = Read 3 = Interactive in 4 = complete
ResponseText server process returns text version of data
Responsexml server process returns data for compatible DOM XML document objects
Status codes returned by the status server, such as: 404 = "File not found", 200 = "Success"
StatusText status text information returned by the server
This is the end of this article (want to see more on the Topic.alibabacloud.comAJAX User manual section of the study), there are questions can be in the message below the question.