JavaScript Libraries

On pages 5–6, we implemented about 30 lines of JavaScript code to implement the simplest of Ajax use cases. And there are undoubtedly browser-specific issues for which our simplistic Ajax code does not account.

To reduce the amount of JavaScript code you need to write for Ajax requests, and to make sure those requests succeed across multiple browsers, you should use a JavaScript library that neatly encapsulates those boring details and sharp edges in convenient JavaScript objects.


For the rest of this short cut, we’ll use the Prototype JavaScript library to take care of our Ajax calls. Prototype is a popular library that has Ajax support, among other things, built in. For example, here are those 30-some lines of ...

Get AJAX and JavaServer™ Faces now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.