Web 2.0 with AJAX

Web 2.0 refers to many things but is primarily refers to the usability and enhanced functionality afforded users with the compliance of most browsers to a common set of web standards defined by the World Wide Web Consortium [W3C] so that technologies such as AJAX can be expected to perform reliably in all browsers. The acronym, AJAX, represented “Asynchronous JavaScript and XML” when first coined and has since expanded to include a style of web capabilities that include the integration of XML, DOM, CSS, JavaScript and other technologies that give web pages the functionality resembling that of desktop applications.

From HTML to XML

HTML 4 brought about a variety of improvements that accommodate the evolving graphical interface of the Internet. With the use of Cascading Style Sheets [CSS] site builders could separate content from style. Separating content from style allows the content to be displayed with a style suitable for the device displaying it, be that a printer, monitor or hand held device. And 4 was also the first HTML standard that recognized the role of client-side scripting such as JavaScript. When a browser loads an HTML document it creates a map of all the elements in the document or Document Object Model [DOM] that the client-side scripts can act upon. These are object that scripts that can act on within the browser without sending a request to the web server.

XML [Extensible Markup Language] is another great advance that provides the “X” in AJAX. Extensible in that it is a language for creating custom markup languages. While HTML has fixed elements XML allows developers to create custom tags and control how they are displayed using XSL [eXtensible Stylesheet Language] or CSS . Further, it provides a non-proprietary medium for exchanging and displaying data described by the custom elements. With this power you can build customized models for displaying data on the web. The perfect example would be the product catalogs of Amazon.com.

XHTML allows site builders to wrap the capabilities of XML in a HTML style presentation. In contrast to the formal nature of standards development by the W3C, the XHTML 1.0 recommendation encompasses elements of HTML 4.01 and certain XML features regarding document structures. To take advantage of XML capabilities the document must stand up to the rigorous requirements necessary to pass XML source code validation. The often lax dissiplin of many HTML site builders will not be tolerated. Even if a new site has no immediate plan for utilizing XML in the near future these requirement should be implemented for future compatibility.

XMLHttpRequest JavaScript Class

Here is where the power of AJAX application development takes place. The XMLHttpRequest object enables an asynchronous [the "A" in AJAX] HTTP request whereby a script sends requests and receives responses to and from the web server without the user leaving the page. If you are a user of Gmail or Yahoo! webmail you are witness to this process and already take it for granted. Input can be sent to the server and the response received by and acted upon by JavaScript to update a piece of the page.

With the proliferation of AJAX there is a growing collection of libraries of code and references available to facilitate the use of XMLHttpRequest. These include Google AJAX APIs, the Yahoo! User Interface Library [YUI], along with several independent developer libraries such as dojo and Prototype. If you don’t have sufficient experience with JavaScript trying to dive in to these sites can be quite daunting. There are some great online references online such as those found at Webmonkey.com. To gain a comprehensive understanding of the technologies with concise examples the book by Thomas Powell shown to the right is an excellent place to start.

Leave a Comment

You must be logged in to post a comment.