0% developed

Programming Ajax

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Ajax or "Asynchronous JavaScript and XML" is a phrase that was coined in 2005 by Jesse James Garret of Adaptive Path in his introductory article on the subject. (For a complete definition of the item, please see the Wikipedia Ajax entry.)

The purpose of this guide is to show how to unobtrusively add Ajax into your web application in such a way that your site will continue to function even when JavaScript is not enabled. Through intelligently hooking JavaScript triggers to certain elements in your markup, you can successfully add a new layer of interactivity to your site without sacrificing backwards compatibility with browsers which do not support Ajax. In this way, you can enhance your site without cutting off users that choose to not enable JavaScript because of their security concerns (warranted or not) or due to browser quirks.

There are several web sites already dedicated to promoting (or denouncing) the use of Ajax. Therefore, wherever possible, an attempt will be made to list these resources without bias. Although I fully invite anyone to add to this document, because of intellectual property and copyright reasons, it's just impractical to get the consent of everyone to include their content. Besides, these sites often showcase the very concept that they are attempting to describe.

When a concept is relative to Ajax it should be described here, but the definitive work should be relegated to other Wikibooks or websites where that concept has already been (or should be) fleshed out.

In light of this, there are several concepts with which you should become familiar if you want to work with Ajax. Although, not all of them are expressly required to cut and paste in some sample code, for hacking out your own code, the following are recommended.

To make programming in Ajax easier, web developers may make use of a JavaScript library for Ajax. These JavaScript libraries allow the common problems of browser support for certain required objects to be abstracted, and mean that the developer can get on with the task of writing their application.

Further reading[edit | edit source]