It’s hard to talk about Ajax without first talking about the Internet’s recent explosion in web-based applications known as Web 2.0. When it comes to loaded buzzwords Web 2.0 is a heavy lifter. Known for its big fonts, image gradients and gratuitous use of white space, Web 2.0 sites are attracting venture capital reminiscent of the old dot-com days and driving it is Ajax. In this article I hope to demystify Ajax and help you decide if Ajax is right for you.
Wikipedia defines Ajax as a web programming technique to “exchange small amounts of data with the server behind the scenes, so that the entire web page does not have to be reloaded each time the user requests a change.” This breaks the endless cycle of click, stop and wait that Internet users have become so accustomed to. Ajax is a technique, not a programming like PHP or .NET and can be implemented on any web site regardless of the server OS or scripting language. Another way to think of Ajax is that it enhances your web site functions not the function of your web browser. Ajax resides on the client’s computer, which means that it relies on the user having a compatible JavaScript-enabled browser.
Although all the functionality for writing Ajax applications has been available to web developers since JavaScript was first introduced in the late 90’s, it wasn’t until Google’s gmail popularized it that Ajax began to garner notoriety. Armed with slick graphic designs and Ajax-enabled pages, several early adopters took web applications to new heights and raised the bar for the rest. Sites like Digg, MySpace and even Google have hugely benefited from the new techniques and so have their users.
When it comes to implementing Ajax on your site, moderation is the key. Ajax works best when it has lots of data to look up or when it is updating a small piece of data like a counter or a switch. For an example, consider an online bookstore, with thousands of books listed in a database and an online application to manage the list. Ajax, powering a “Live Grid” in the book catalog, makes looking up books fast and spreadsheet like. Ajax can also communicate status switches like updating a book from on or off-line and even adjust sort orders for layouts on the e-commerce site. Using Ajax to submit a new book record, login to the backend or communicate with your visa merchant would probably not show any advantage other than your prowess as an elite web developer. That is, until the project manager gets on your case for unnecessary functionality and budget overrun. Also remember that although you could control the browser versions at the store, on the live site you would have to duplicate code in HTML for those who are shopping without a JavaScript browser. So take some time to consider if your application could benefit from using Ajax and don’t be taken in by its newness and marketing appeal.
I myself was pleasantly surprised at how simple it was to install Ajax functionality into my applications. The Prototype JavaScript libraries along with Scriptaculous and Rico are fantastic frameworks to start from and are easily implemented with minimal overhead. Once I came to the realization that Ajax simplified my applications it became very easy to make Ajax a regular part of my web development toolkit.