Ajax, Ajax Everywhere
In February 2005, Adaptive Path published an essay called “Ajax: A New Approach to Web Applications” by Jesse James Garrett. This week I got to participate in an Ajax Summit sponsored by Adaptive Path and O’Reilly. Yes, there were just three months in between the naming and the first conference. That’s fast even at internet speeds.
You know how the web works, right? You click a link in a browser and your computer says, “hey server, send me this page.” And the server says, “sure, here ya go.” And you see the page. Click, rinse, repeat.
Ajax, and the pile of techniques and technologies that get lumped in with it, are all about breaking that page-by-page web experience into smaller chunks. If the traditional web was letter writing, Ajax is instant messaging.
Right about here is when the inevitable example of Google Maps comes up. And for good reason. It’s just so darn cool to click and zoom around. But it obscures what Ajax is really about. It’s like using a race car to explain what an engine is. It’s in there, sure, but wow look at it go!
The more compelling examples are the smaller ones. If you’re a Flickr user, and you’ve ever clicked on a photo title to edit it, that’s Ajax. Or explore Dunstan Orchard’s fabulous LiveSearch, which presents search results as you type. Or explore any of the new web apps from 37 Signals. Ajax, Ajax everywhere.
Put simply, Ajax lets web pages to go back to the server for updates in between page refreshes. Before, once you got the page, you were done. But now, with Ajax, the page can respond with server smarts as you interact with it.
Perhaps a concrete example would help.
Tell me if this sounds familiar: You’re signing up for a membership at a website. You enter a username, password, password confirmation, URL, and an email address. Pretty simple, right?
Except the username you picked was taken. What happens? The entire page is submitted to the server, the server says “no way dude” and the entire page is sent back to you with an error statement. All you can do is change the username and submit it again. And again. And again.
And when you finally pick a username that’s available, you realize you flubbed your email address. Fix that, but you forgot the email confirmation. Fix that and you realize you forgot the @ in your email address.
Each time you submit the form it goes all the way to the server and all the way back. It’s frustrating for you, taxing to the server, clogging for the network. There has to be a better way.
With Ajax, as soon as you enter that username, the page checks with the server to see if it’s available. The page can even make the related fields active only when the username comes back okay. It does this with simple, background server requests that send small data fragments back and forth, instead of the whole page. The page can then update to reflect that the data was accepted in real time.
This is just one boring example of the way Ajax can make websites easier to use. Data entry in web forms has always been an especially cruel thing to do to a user and a real point of failure for business applications. By progressively validating form contents as you go, and even adding entire sections only if they’re needed, we can finally solve a long-standing interface nightmare.
On its own, Ajax is nothing more than a tool on a workbench. To use it well, it will take a lot of experimenting, a lot of conversation between designers and coders, and a lot of trial and error. There are problems to be solved with the interface (how will a user react to a form with no save button?) and with the technology (how can we support older browsers without a ton of extra work?) and with existing web conventions (how do I bookmark this?).
But none of those questions can get answered unless people sit in a room, or get together online, and ask them. There will be more gatherings and more blog posts. The work is just beginning.
The core takeaway for me is this: Stop thinking about the web in terms of pages that go from a server to a browser, and instead think of pages as collections of chunks that can each go to and from a server as needed. In many ways, it reminds me of the revolutionarily simple lesson from blogs: When you think of the web as posts instead of pages, important things happen. In the same way, thinking of the web as dynamic portions of pages opens up all sorts of user interface opportunities.
We web developers have an opportunity with Ajax to really improve the user experience on the web. And I, for one, can’t wait.