The Ajax Approach to Browser Scripting (Top ten web hosting) CHAPTER 9
The Ajax Approach to Browser Scripting CHAPTER 9 In the previous chapter, I showed you how to use the World Wide Web Consortium (W3C) Document Object Model (DOM) to work with XML documents in a web browser. I loaded an XML document and manipulated the structure using JavaScript and the DOM. I used the xDOM library to create cross-browser JavaScript appropriate for both Internet Explorer (IE) and Mozilla. In this chapter, I ll show you another way to work with XML on the client using Asynchronous JavaScript and XML (Ajax). Jesse James Garrett of Adaptive Path coined the term Ajax, which describes an approach to creating XML applications using XML with XHTML, Cascading Style Sheets (CSS), the DOM, JavaScript, Extensible Stylesheet Language Transformations (XSLT), and the XMLHttpRequest object. It is part of the Web 2.0 approach, where the request-response nature of the web is largely invisible to the end user. In Web 2.0, the user experience is much more like working with a desktop application. Building applications with Ajax provides all of the advantages of working client-side with XML content. The application caches the interface and makes asynchronous requests for data. The user isn t waiting for pages to load from the server. Another advantage of Ajax is that you can use the approach with most major browsers. The XMLHttpRequest object is available on IE for Windows, Safari on Macintosh, Mozilla, and Opera 8 and above. If you use Ajax with XSLT on the client, it s available to IE, Mozilla, and Safari. However, this is likely to change when Opera releases version 9 of its browser software. Ajax is a mainstream approach, and you can see examples of it working in Google Suggest (http://www.google.com/webhp?complete=1&hl=en), Google Maps (http://maps.google.com/), and Flickr (http://www.flickr.com/). I ll work through some examples so you can understand how to use Ajax. You can download the resources used in this chapter from the Source Code area of the Apress web site (http://www.apress.com).
Please visit our professional web hosting services to find out about cheap and reliable webhost service that will surely answer all your demands.