Skip the navigation

So how do you code an AJAX Web page?

See hands-on examples for creating lighter, faster interactive sites

By Edmond Woychowsky
August 3, 2006 12:00 PM ET

Computerworld - This article is excerpted from the soon-to-be-published book AJAX: Creating Web Pages with Asynchronous JavaScript and XML by Edmond Woychowsky, copyright Pearson Education Inc. Reprinted with permission from Pearson Education, all rights reserved. The book is part of the Bruce Perens’ Open Source Series.

A little more than a year ago, an article by Jesse James Garrett was published describing an advanced Web development technique that, even though individual components of it have existed for years, few Web developers had ever stumbled across. I can guess the reason for this lack of knowledge; basically, in the last few years, the need to produce measurable results has gotten in the way of the need to practice our craft. Or, as a former manager of mine would say, it's "that mad scientist stuff," except, as I recall, he used another word in place of stuff. Unfortunately, nine times out of ten, the need to produce measurable results gets in the way of "that mad scientist stuff."

However, it's the tenth time that's important. The article didn't stop at just describing the technique; it went on to say that Google used the very same technique. Invoking that single name, Google, was enough to change a point of view. Quicker than you could say, "Igor, the kites!" the phrase "that mad scientist stuff " morphed into "Why aren't we doing it this way?" The reason for this change of perception is that the name Google made this a technique that could produce measurable results. All it took was that single name, Google, to make using the XMLHTTP Request object so that the browser could communicate with the server without the page ever unloading and reloading into an acceptable practice.

This article introduces you to that practice, the practice of updating Web pages with information from the server. Beyond the XMLHTTP Request object, which has been around for several years as a solution looking for a problem, there is nothing weird needed. Basically, it is how the individual pieces are put together. When they're put together in one way, it is nothing more than a pile of parts; however, when put together in another way, the monster essentially rises from its slab.

Not a mockup

A few years ago, I demonstrated an application that did what I just described. The demo ran for more than 2 hours with the same questions repeated over and over.

"It's a mockup, right?"

"No, it is the actual application."

"It can't be. The screen doesn't blink."

"That's because XML, HTTP and SOAP are used to get the data directly from the server. JavaScript then updates only the parts of the page that have changed."

"It's a mockup, right?"

And so on. It took the client more than 2 hours to realize that the database was actually being updated without the page "blinking," as he referred to it. 

A technique without a name

Now, if I had been smart, I would have given the technology a name then and there, and thus ensured my place in Web history, shutting up the client as well. After all, a name is a thing of power, and the client, not wanting to sound stupid for not knowing what the acronym meant, would have saved more than two hours of my life that were spent re-enacting the scene of peasants with pitchforks from the 1931 version of Frankenstein, minus the tongs. Unfortunately, I drew an absolute blank and just called it as it was.

With apologies to the people who make the cleanser and the detergent, legend has it that the original AJAX was the second most powerful of the Greek warriors at Troy. Even though he had some issues (who in The Illiad didn't?), his strength and skill in battle were second to none (well, OK, second only to Achilles). In naming the technology AJAX, Jesse James Garrett gave the technology both AJAX's strengths and issues. 



Additional Resources
Forrester Consulting - Optimizing Users and Applications in a Mobile World
WHITE PAPER
Solving application issues over the WAN requires careful consideration. Based on their independent research, Forrester Consulting offers recommendations on how to tackle application performance issues, insufficient bandwidth and the inability to quickly restore users in a disaster.

Read now.

Security KnowledgeVault
WHITE PAPER
Security is not an option. This KnowledgeVault Series offers professional advice how to be proactive in the fight against cybercrimes and multi-layered security threats; how to adopt a holistic approach to protecting and managing data; and how to hire a qualified security assessor. Make security your Number 1 priority.

Read now.

Cut Communications Costs Once and for All
WHITE PAPER
New IP-based communications systems are being deployed by small and midsized businesses at a rapid rate. Learn how these organizations are enabling faster responsiveness, creating better customer experiences, speeding office or mobile interactions, and dramatically reducing existing communications costs.

Read now.

App Development White Papers
The Keys to Distributed & Agile Application Development
How leading firms are winning with strategies for efficient application development, without relying on co-location.
Overcome Top 7 Admin Challenges of Active Directory
As Active Directory's role in the enterprise has drastically increased, so has the need to secure the data. Gain insight on creating repeatable,...
Insiders Can Ruin Your Company. Take Action.
Did you know that 80 percent of threats to an organization come from the inside? The threat from insiders is often overlooked in...
Top Solutions and Tools to Prevent Devastating Malware
Custom malware frequently goes undetected. According to Forrester Research, the best way to reduce risk of breach is to deploy file integrity monitoring...
Streamline Compliance and Increase ROI
Streamline, simplify, and automate compliance related activities; especially those that impact multiple business units. This white paper from NetIQ, outlines solutions that will...
All App Development White Papers
App Development Webcasts
Reduced TCO for Communications Applications with New Oracle SPARC Servers
In this webcast learn how Oracle's new SPARC T4 servers and SPARC Supercluster deliver the security, performance, and scalability required for 4G network...
Optimizing Networks for the Cloud
Join guest speaker, Rohit Mehra, IDC Director of Enterprise Communications Infrastructure, to explore current trends, discuss best practices for optimizing Data Center and...
Apps QuickStart Series Part 2: Designing and Deploying SQL Server on VMware vSphere
Download this webcast to learn about the design considerations for virtualizing SQL workloads, performance and scalability information and high-availability options, as well as...
Apps QuickStart Series Part 1: Designing and Deploying Exchange 2010 on VMware vSphere
Download this webcast to learn the virtual hardware design considerations for Exchange 2010, deployment using the building block approach, options for high-availability and...
Customer Spotlight: How IPC The Hospitalist Company Implemented Oracle on VMware
Have you been looking to hear about customer's experiences with the new VMware vCenter Site Recovery Manager product? View this webcast to learn...
All App Development Webcasts
Newsletter Sign-Up

Receive the latest news test, reviews and trends on your favorite technology topics

Choose a newsletter
  1. View all newsletters | Privacy Policy
IT Jobs