May 23, 2005

AJAX breathes new life into Web apps

Forget what you knew about JavaScript, DHTML, and the browser; it's a whole new ball game

One year ago, Thomas Lackner didn’t ask much of JavaScript. When he sketched out the architecture to a Web application, he knew he could count on the browser language for “set-a-cookie hacks” and for loading images, but he turned to the server side for the heavy lifting. But when Google began launching highly interactive Web sites such as Gmail and Google Suggest, the scales dropped from Lackner’s eyes and he saw the opportunity.

“It all clicked in my head the middle of 2004,” Lackner says. “I started trying to add AJAX components to every Web app I worked on.”

AJAX is the newly minted acronym encompassing a fresh vision of empowered browsers: Asynchronous JavaScript and XML. Before AJAX, Web pages displayed links, forms, and buttons. When a user clicked on a link or a button, the browser sent a message to a distant server asking what to display next. JavaScript would typically be used for nothing more than to check form inputs. Web pages were as static as pages in a book.

The post-AJAX browser can think on its own without saying “Mother may I?” to a distant server. Processing threads running in the background preloads page content. If a user clicks on a link or a button, the browser can update page content using JavaScript. Google’s Gmail, for instance, hides or displays parts of an e-mail thread without waiting for a response from its server, eliminating network lag. If information must go to the server, it too is sent by a background process.

Brendan Eich, the creator of JavaScript at Netscape, says the world is just now discovering what he imagined back in 1995. He says, “We [Marc Andreessen and I] always intended JavaScript to enable client-centric apps that did not have to reload pages from a server.”

A new kind of app

AdaptivePath’s Jesse James Garrett, who coined the AJAX acronym in an essay written in February, says that the response has been surprising. “Right now, it’s all so new that what we’ve got is a lot of excitement,” he says.

The excitement is understandable when you consider the advantages AJAX brings. For one thing, it greatly simplifies software distribution. Browsers load AJAX applications automatically. Customers are often reluctant to install custom applications, but most people can be convinced to visit a Web site.

The AJAX approach has several other advantages, as well. JavaScript running on the client reduces bandwidth and processing demands on the server. Well-designed code that is truly asynchronous also gives the server more time to respond to queries, reducing this load even further by spreading out peak demands. It even increases security by encrypting data on the client side, before it travels across the network.

The Basecamp project-management application from 37signals is a good example of a Web application developed using the new paradigm. Adding a new to-do item pops open a window to accept input without a round-trip to the server. But when the new item is saved, the browser still must wait to ensure that it was stored successfully. JavaScript code updates the server in the background while displaying the note, “Moving ... Just a moment.” There is still plenty of interaction with the server, but the JavaScript code speeds it by handling many of a user’s clicks.

David Heinemeier Hansson, a programmer at 37signals, says he’s concentrating on removing the lag time when a user submits a form. “If you have a Weblog and you add a comment, it will be updated on the server side in the background. Whenever you need to add or change content, you can do it without reloading.”

Close

On Twitter now

Application development

Powered by Twitter

White Paper

D2D Virtual Tape Library Replication Primer

This whitepaper explains the terminology and concepts behind Data Replication technologies and establishes some sizing rules through worked examples. Learn the new paradigm in disaster tolerance—protect data anywhere.

Download now »

White Paper

An Alternative to Virtualization for Datacenter Cost Savings

Server virtualization is a popular option for dealing with mounting datacenter costs. Another equally promising approach is the use of an Application Delivery Controller. Citrix NetScaler provides a low-cost way for organizations to reduce their server count and accrue cost savings from a reduction in space, cooling, power and personnel.

Download now »

White Paper

Why Your Firewall, VPN, and IEEE 802.11i Aren't Enough to Protect Your Network

The emergence of WLANs has created a new breed of security threats to enterprise networks.

Included in HP ProCurve WLAN solutions is security technology that alleviates threats from WLANs through:
* Monitoring wireless activity inside and out of the enterprise
* Classifying WLAN transmissions into harmful and harmless
* Preventing transmissions that pose a security threat to the enterprise network
* Locating participating devices for physical remediation

Download now »

White Paper

Bringing the Edge to the Data Center

Effectively address data protection challenges, implementing solutions that help store and protect business–critical data while cutting costs and improving efficiency and reliability.

Download now »

Subscribe to the Developer World Newsletter

Receive a weekly roundup about the art and science of software development.

©1994-2009 Infoworld, Inc.