ajax-Creating XMLHttpRequest Objects
1.XMLHttpRequest is the basis of Ajax, all now supported by browsers, for exchanging data in the background with the server, which means that the entire page can be updated without loading the entire page.
2. All modern browsers support XMLHttpRequest objects.
Create XMLHttpRequest object syntax: xmlhttp = new XMLHttpRequest ();
3. For all modern browsers, including IE5,IE6. First check whether the XMLHttpRequest object is supported, create the XMLHttpRequest object if supported, and create ActiveXObject if not supported.
The old version of IE (5,6) uses the ActiveX object syntax: XMLHTTP = new ActiveXObject ("Microsoft.XMLHTTP");
4. in order to save time by writing Ajax, you can package object detection into a good function to take
function Gethttpobjet () {
var xmlhttp = false;
if (window. XMLHttpRequest) {//code for ie7+, Firefox, Chrome, Opera, Safari
Xmlhttp=new XMLHttpRequest ();
}else {//code for IE6, IE5
Xmlhttp=new ActiveXObject ("Microsoft.XMLHTTP");
}
return xmlhttp;
ajax-Creating XMLHttpRequest Objects