A: Brief introduction
1. Basic Concepts
AJAX refers to asynchronous JavaScript and XML (asynchronous JavaScript and XML).
AJAX is a programming model that was popularized by Goo Gle in the 2005.
AJAX is not a new programming language, but a new method of using existing standards.
With AJAX, you can create better, faster, and more user-friendly WEB applications.
AJAX is based on JavaScript and HTTP requests (HTTP requests).
2.ajax Advantages
AJAX uses asynchronous data transfer (HTTP requests) between the browser and the Web server, which allows the Web page to request a small amount of information from the server, rather than the entire page.
AJAX can make Internet applications smaller, faster, and friendlier.
AJAX is a browser technology that is independent of WEB server software.
3. Web-based Standards
AJAX is based on the following WEB standards:
Javascript
Xml
Html
Css
The WEB standards used in AJAX have been well-defined and supported by all major browsers. AJAX applications are independent of browsers and platforms.
Two: Ajax in http Request
1. Traditional Requests
One HTML table must be used to GET or POST data from the server. Users then need to click the Submit button to send/Receive information, wait for the server to respond, and a new page will load the results.
2. using Ajax requests
With AJAX, your JavaScript communicates directly with the server through JavaScript's XMLHttpRequest object.
By using an HTTP request, a Web page can make a request to the server and get a response from the server without loading the page. Users can stay on the same page, and users will not notice that the script has requested pages in the background or sent data to the server.
Three: Ajax the browser support
The main point of AJAX is the XMLHttpRequest object.
There are differences in the way that different browsers create XMLHttpRequest objects.
Internet Explorer uses ActiveXObject, while other browsers use JavaScript built-in objects called XMLHttpRequest.
To create this object for a different browser, we'll use a try and catch statement.
Simple case:
<!doctypehtml>
<metacharset= "Utf-8" >
<title> Untitled Document </title>
<body>
<scripttype= "Text/javascript" >
function Ajaxfunction () {
var xmlHttp;
try{
Firefox, Opera 8.0+,safari
Xmlhttp=newxmlhttprequest ();
}
catch (e) {
IE browser
try{
Xmlhttp=newactivexobject ("Msxml2.xmlhttp");
}
catch (e) {
Window.alert ("Your browser does not support ajax! ");
return false;
}
}
}
</script>
<formname= "MyForm" >
User: <input type= "text" name= "username"/>
Date: <input type= "text" name= "Time"/>
</form>
</body>
Copyright Notice: Bo Master original articles, reproduced please indicate the source. Http://blog.csdn.net/dzy21
Basic AJAX Concepts