Unintentionally Blank

Phil Nash on the Internet, Web Standards and Accessibility

Learning AJAX: Lesson 1 - Don't Use AJAX

Jul 06, 2007

by Phil Nash

Time to learn some hardcore javascript. Having played with the DOM I have decided that a good use of my time right now to get a start on some AJAX, the buzzword and technology of Web 2.0.

AJAX stands for Asynchronous Javascript and XML, which is a touch misleading as you needn't use XML. The first part of the name does make sense, however, as the idea is to use javascript to fetch data from the server without reloading a page. It is useful as loading content only is much quicker than a whole page and it makes a web site seem more like standard desktop applications, for more details see the Adaptive Path introduction to AJAX.

Don't Use It?

Sure, starting off learning AJAX with this sort commandment seems a bit strange, but, as you may know by now, the accessibility of a web site is high on my priority list. Since AJAX is powered mostly by javascript, none of it is available if a user has javascript deactivated.

Does this mean if we want to create accessible web sites that we can't use AJAX? Not if we use the principle of progressive enhancement -- creating a site that is fully accessible to everyone through valid, semantic, accessible markup and then enhancing the experience through unobtrusive javascript and AJAX.

Essentially, to make AJAX, or any javascript, work, we must first make a site or application that functions fully without it.


In order to learn AJAX, I am therefore going to start with a function that requires no javascript whatsoever, then I am going to build in some extra functionality that those with javascript will be able to use. My example will be a random quote generator, right now refreshing will bring up one of 5 different quotes. To bring javascript and AJAX in, I will make it possible to load another quote without refreshing the page, but that's for another post.

Unintentionally Blank is Phil Nash's thoughts on web development from 2006-2008. Any code or opinions may be out of date.