Bulletproof Ajax

The prospect of learning Ajax may seem intimidating. Don’t worry: it’s not as complicated as the hype suggests.


This book has everything you need to get started with bulletproof Ajax. You’ll find solutions to the challenges Ajax poses, illustrated with working examples. More importantly, you’ll find explanations for the concepts and answers to the questions surrounding Ajax. So don’t think of this as a programming book—even though you’ll find plenty of code within. Instead, think of this as a guidebook to help you chart the unknown territory of using Ajax.

Ajax is a tricky technology to pin down. Most of the tools we use to make Web sites can be divided into two categories: browser technologies such as HTML, Cascading Style Sheets, and JavaScript; and server-side technologies such as Apache, PHP, and MySQL. Ajax sits somewhere between the browser and the server. Ajax requires JavaScript, which is a client-side language, but it also involves communication with the server. So whose job is it anyway?

With the explosion of interest in Ajax, server-side programmers are migrating to the browser in droves. They bring many years of experience in software design and object-oriented programming with them, but they aren’t necessarily prepared for the unique challenges of developing in the browser. Meanwhile, client-side developers dipping their toes into the waters of Ajax are confronted with a tsunami of new technologies to be mastered.

There are plenty of books out there aimed at server-side programmers who want to learn about Ajax. This isn’t one of them. If you’re a Java programmer accustomed to creating complex objects, put this book down and move on to the next book on the shelf. If you’re a front-end developer, this is the book for you. You’re probably well-versed in Web Standards. I trust you‘re using semantic markup and CSS, perhaps even some rudimentary DOM Scripting. If so, read on.

The prospect of learning Ajax may seem intimidating. Don’t worry: it’s not as complicated as the hype suggests. As you’ll see, the JavaScript code isn’t very complex. The hard part is making sure your Ajax applications are bulletproof.

In August 2005, New Riders published a great book called Bulletproof Web Design, by Dan Cederholm. Dan’s philosophy centers around flexibility. Using flexible design elements that adapt to the user’s needs, Web sites continue to work beyond the typical browsing environment. I believe that the same philosophy can be applied to Ajax.

Far too many Ajax applications are built like a house of cards, dependent on just the right stack of technologies in the browser. Browsers that don’t support the required technologies are locked out and their users are turned away. To avoid this, you need to create flexible applications using bulletproof Ajax.

I’ve created a companion Web site where you can download and try all the examples used in this book. If you’d like to keep track of the latest developments in JavaScript and Ajax, visit my DOM Scripting blog at http://domscripting.com/blog/.