Introducing XMLHTTPRequest
XMLHTTPRequest is supported by virtually all modern browsers, including Microsoft's Internet Explorer 5+ and a variety of non-Microsoft browsers, including Mozilla, Firefox, Konqueror, Opera, and Safari, and is supported on a wide range of platforms, including Microsoft Windows, UNIX/Linux, and Mac OS X.
Caution
![]() | Some browsers may require attention to their security settings to allow the XMLHTTPRequest object to operate correctly. See your browser's documentation for details. |
The purpose of the XMLHTTPRequest object is to allow JavaScript to formulate HTTP requests and submit them to the server. Traditionally programmed web applications normally make such requests synchronously, in conjunction with a user-initiated event such as clicking on a link or submitting a form, resulting in a new or updated page being served to the browser.
Using XMLHTTPRequest, however, you can have your page make such calls asynchronously in the background, allowing you to continue using the page without the interruption of a browser refresh and the loading of a new or revised page.
This capability underpins all Ajax applications, making the XMLHTTPRequest object the key to Ajax programming.
Tip
![]() | Although the object's name begins with XML, in fact, any type of document may be returned from the server; ASCII text, HTML, and XML are all popular choices, and we will encounter all of these in the course of the book. |