Other Libraries

There are a growing number of Ajax libraries available to use, from the simple to the complex. We'll briefly examine a few others to give you an idea of the wealth of useful functionality already created for your use.

Tip

A handy list of many of the Ajax libraries can be found at the eDevil weblog at http://edevil.wordpress.com/2005/11/14/javascript-libraries-roundup.

jQuery

One library that's quickly gaining popularity is jQuery, available at http://jquery.com. It's small, fast, and provides fundamental cross-browser methods to work with the DOM rather than higher-order effects.

Tip

The Interface library, found at http://interface.eyecon.ro, provides higher-order effects for jQuery, similar to what script.aculo.us provides for Prototype.

Unlike the other libraries, though, jQuery has only one object, the jQuery object. Unfortunately, jQuery uses the dollar sign shortcut, $( ), to reference this object. If you want to use jQuery with other libraries, especially Prototype, you have to use the jQuery.noConflict( ) function call at the very start of any script block to restore the other libraries back to their normal behavior. The literal jQuery object is then used as a way of accessing all of the functionality.

jQuery provides a high degree of chainability, which is the ability to chain function calls, one after another. This type of functionality requires that the library object methods return a reference to the object itself, which is used in the next method in the chain. ...

Get Adding Ajax now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.