XMLHttpRequest is the basis of AJAX.
All modern browsers support the XMLHttpRequest object (IE5 and IE6 use ActiveXObject).
XMLHttpRequest is used to exchange data with the server behind the scenes. This means that parts of a web page can be updated without reloading the entire page.
All modern browsers (IE7+, Firefox, Chrome, Safari and Opera) have built-in XMLHttpRequest objects.
Syntax for creating XMLHttpRequest objects:
variable =new XMLHttpRequest();
Older versions of Internet Explorer (IE5 and IE6) use ActiveX objects:
variable =new ActiveXObject("Microsoft.XMLHTTP");
To work with all modern browsers, including IE5 and IE6, check whether the browser supports the XMLHttpRequest object. If supported, an XMLHttpRequest object is created. If not supported, create an ActiveXObject:
In the next chapter, you'll learn about sending server requests.