AJAX - web applications the easy way
IT Pro Guide: It's not a cleaning product, or a hero from classical civilisation... so what is it? Marcus Austin delves into the detail behind AJAX, one of the Web's latest buzzwords
You will all by now have used web applications such as Google's Gmail email service or their Toolbar service. If not then perhaps you should, because you'll be amazed by just how quickly they work.
The main reason why Ajax applications are so fast at what they do is because they're client-side applications that run on users' PCs. Redraws and any graphical manipulation are all taken care of by the client's processor rather than the web servers at the other end, which increases the speed of response, reduces the server's processor overhead and increases the interactivity between websites and users.
It's a great choice for Web-based chat programs, where many users can chat together at the same time, grabbing lists of data, as in Google's Suggest beta (http://www.google.com/webhp?complete=1), for enabling interactivity in pop-ups, dragging and dropping, or modifying web pages on the fly.
How does it do that?
AJAX works by exchanging small amounts of data with the server behind the scenes, so that the entire Web pages do not have to be reloaded each time the user makes a change. To the user it looks and feels much more like using a desktop application than a traditional web application.
Another common complaint about AJAX applications is that they can break back button functionality in browsers. Google Maps demonstrates, however, that with careful coding, such browser functionality need not be compromised.
Because AJAX requires so many features to be enabled before it will work and it's limited to just a few browsers, anyone working on AJAX web applications should look at providing fallback options for those on other platforms or browsers - visually impaired users, for instance. It's also essential that you don't rely on it as the only way you interact with your users.
Be aware, however, that some fallback options can put extra strain on your server and can be time consuming to build, so developers need to make the decision early on as to how important those non-AJAX users are. Google has made the decision for Gmail not to fall back, for instance, and it gets around this by keeping the service in a constant state of beta, playing a waiting game with users' browser capabilities.