Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

A Detailed Explanation of the XMLHttpRequest Object

The XMLHttpRequest object is at the technological root of all AJAX and Web 2.0 applications. Although software vendors and the open source community now supply many AJAX frameworks that simplify using the XMLHttpRequest object, it's still worth your time to know the fundamentals.


advertisement
synchronous JavaScript and XML (AJAX ) is a term for the process of transferring data between a client script and the server. The advantage of this is that it provides developers with a way to retrieve content from a Web server without posting the page the user is currently viewing to the server. In concert with modern browsers' ability to dynamically change displayed content through programming code (JavaScript) that accesses the browser's DOM, AJAX lets developers update the HTML content displayed in the browser without refreshing the page. In other words, AJAX can make browser-based applications more interactive, more responsive, and more like traditional desktop applications. Google's Gmail and Outlook Express are two familiar examples that use AJAX techniques. AJAX may be used with any client-side scripting language, including JavaScript, JScript, and VBScript.

AJAX takes advantage of an object built into all modern browsers—-the XMLHttpRequest object—to send and receive HTTP requests and responses. An HTTP request sent via the XMLHttpRequest object does not require the page to have or post a <form> element. The 'A' in AJAX stands for "asynchronous," which means that the XMLHttpRequest object's send() method returns immediately, letting the browser processing of other HTML/JavaScript on the Web page continue while the server processes the HTTP request and sends the response. While asynchronous requests are the default, you can optionally send synchronous requests, which halts other Web page processing until the page receives the server's response. Microsoft introduced the XMLHttpRequest object as an ActiveX object in Internet Explorer (IE) 5. Other browser manufacturers, recognizing the object's utility, implemented the XMLHttpRequest object in their browsers, but as a native JavaScript object rather than as an ActiveX object. In turn, recognizing the value and security in that implementation type, Microsoft has recast the XMLHttpRequest in IE 7 as a window object property. Fortunately even when the implementation (and thus invocation) details differ, all the browsers' implementations have similar functionality and essentially identical methods. The W3C is working to standardize the XMLHttpRequest object, releasing a working draft of the W3C specification

This article discusses the XMLHttpRequest object API in detail, listing and explaining all the properties and methods.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap