Web 2.0 Blog Logo

Judicial use of AJAX – 6 Guidelines

AJAX is certainly a hot topic at the moment which has led to a number of sites using AJAX where its not necessary or appropriate. This is similar to the situation we found ourselves in when Javascript, Images, Animated Gifs, Flash, *insert hot new thing here* and pretty much every other facet that makes up websites came into being. At the moment, this means that the sign of a good design isn’t how its used AJAX but more where its chosen not to use AJAX. We can cheat a little by following some simple rules when deciding whether to AJAXify a function or not.

Bear in mind that for the purpose of this article AJAX will be referring to any form of asynchronous processing that happens on the client side. So this can just as easily include things like iFrames (the approach most commonly used prior to AJAX) and dynamicaly swapping divs. Its also worth noting that these guidelines apply only to the use of AJAX, you should still follow best practice when designing the rest of the site.

So on to the guidelines, what you all came here to see.

  1. Ensure that you don’t subvert the expectations of your users. We can use Javascript to change the behaviour of elements on a web page but really, why would you want to. If you use something like AJAX to change the behaviour of a button, for example, your going to confuse your users, and if you changed the way a button works then why would your user assumes that anything else works the way they expect.
  2. If your using AJAX to retrieve data, be aware that you are preventing the user from easily accessing that data on subsequent occasions. This means that they can’t bookmark it and they can’t send a link to people they know. They will also lose the use of the “Back” button in their browser. I would suggest that if you are using AJAX to rerieve data, it should be a subset of the data currently on the page. Or perhaps to change the view of the current data. If the relationship between the two sets of data is further removed than this, I would strongly urge you to use a page refresh (and new URL) instead.
  3. Never sacrifice usibility or accessibility just to use AJAX, or anything else. These are the two absolute fundamental cornerstones of a good site, build upon them.
  4. Make it obvious that your using AJAX. Now that may seem like a stupid thing to say but if you think about, it becomes blindingly obvious. AJAX is a new technology and your users may not be expecting it. So by highlighting the AJAXified bits of your site you will encourage the users to utilise it. A great example of this is the edit-in-place functionality you get in flickr. If you can edit something in place, it highlights yellow when you mouse over it. That not only ensures a level of consistency but will encourage your users to look for areas where they can do the same.
  5. Ensure there is a fallback. This, like many of the other points applies to alot more than just AJAX and basically goes along the lines of, “hope for the best but plan for the worse”. What this essentially means is that even though you would like all your users to have FireFox 1.5 that is fully up to date, on a nice high resolution with all the applicable rights, the odds are you will come across quite a few users who certainly don’t fall into this category. Its all well and good providing a nice AJAX interface but as opposed to attracting users, it will turn away those who’s browsers (or browser configurations) don’t support it. I’m not suggesting for a second that you completely omit AJAX from your site, just make sure its not the only way to do something.
  6. Beware of permanence. A technology such as AJAX poses an interesting problem. It is now possible to perform actions that are permanent without leaving the page. This means that you should really ensure that there are safety measures in place. Wherever possible get your users to confirm any changes that cannot be undone. The most common example is popping up a confirmation message when deleting an object. A better solution would be to keep an archive of old information. The overhead in doing this shouldn’t be too great, just set the item as inactive when it has been changed. If you also stored the date at which an object became inactive you could then run a job that “weeds” out the archived data at regular intervals. Of course this requires a strong database design and really goes beyond the scope of this entry.

I hope some of these guidelines are usefull. Feel free to add some of your own faux pas in the comments. These 6 point are very high level and mostly common sense, sometimes, in these exciting times, people need a little prompting.

This post was written on Tuesday, April 11th 2006 by Simon T and has been categorised under AJAX , Opinion , Technology , Tips , Web 2.0. The trackback URL is here or you could add a response. If you really want to you can Digg this story  or add it to del.icio.us, Technorati Cosmos, Blinklist, furl or Reddit.

One Response to “Judicial use of AJAX – 6 Guidelines”

  1. Djuri Says:

    Useful article, thanks!
    I decided to use AJAX only in the Admin panel for my clients to let it feel more like a desktop application (drag and drop functionality for example).

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>