O'Reilly logo

Adding Ajax by Shelley Powers

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

script.aculo.us

The script.aculo.us library is based on Prototype, extending the functionality with higher-level features and providing a framework in which to create more sophisticated Ajax effects. It got its name using a variation of domain naming of the social bookmarking site, del.icio.us, though there is no association between the two. It can be downloaded from http://script.aculo.us. The version used in the examples in this chapter is 1.7.0.

To use script.aculo.us, you'll need to include both the Prototype and script.aculo.us JavaScript files. You don't need to download Prototype, though, as it's bundled with the script.aculo.us download package:

<script src="javascripts/prototype.js" type="text/javascript"></script>
<script src="javascripts/scriptaculous.js" type="text/javascript"></script>

The script.aculo.us library consists of different effects, each in its own separate file. If you're using only one script.aculo.us effect, you can specify it as part of the URL of the script file within the script src attribute:

<script src="scriptaculous.js?load=effects" type="text/javascript></script>

This script tag loads the main script.aculo.us.js library, which is primarily nothing more than a loader program. The URL in the tag triggers the loader to also load the effects.js file. How this occurs is that the loader gets the script URL, parses out the library (or libraries) to load, and then calls a function that uses document.writeln to "add" the libraries. If no library is named, the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required