AJAX creates an XMLHttpRequest object:
All current mainstream browsers support the XMLHttpRequest object.
This object can be used to exchange data with the server in the background, thus making it possible to update web page content asynchronously without refreshing the entire page.
Special note: IE5 and IE6 use ActiveXObject.
Create an XMLHttpRequest object compatible with IE5 and IE6:
(1). Create an XMLHttpRequest object as follows:
var xmlhttp=new XMLHttpRequest();
(2). Compatible with IE5 and IE6 (using ActiveX objects):
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
The compatibility code is as follows:
var xmlhttp; //IE7和IE7以上或者其他标准浏览器 if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); } //IE5和IE6浏览器 else{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }Next Section