AJAX

The buzzphrase of the moment is AJAX. If you’re a programmer, and you don’t know about this, you will soon. It stands for Asynchronous Javascript And XML, which is an increasingly common technique for updating parts of a web page from a server without having to update the whole thing.

It’s being heavily used by Google in Gmail and Google Maps, for example. And I think it my duty to keep Status-Q readers up to date with such terms so that you can casually drop them into conversations around the water cooler. “Oh no, it isn’t using Flash. It’s based on AJAX…”

3 Comments

Indeed. But you need to be aware that there are a lot of browser differences, and that generating XMLHttpRequests asynchronously is much easier using a wrapper such as Sarissa, which wraps up the differences between IE and Mozilla-based rendering engines. (From memory, when I last did this, you had to invoke a built-in shipped ActiveX object to make it work for IE; this for parsing an XML document returned from a web-server as a DOM object using Javascript on the client).

Check out AnyTerm for a good demo application of AJAX. You can basically have a complete shell window within a browser window, which is very handy for when you’re behind a nazi-firewall which won’t allow outgoing ssh (port 22) connections, but instead allows SSL.

P.S. This page has a pretty diagram showing the XmlHttpRequest and how it links back to a terminal. The Tetris demo is quite playable.

Hi Q,

This just popped up in my referrer log! Thanks for the publicity.

I have only just got the ghastly pun about AJAX and SOAP. What other household cleaning products are involved?

For what it’s worth, here’s my spin on AJAX (i.e. what I’ve learnt from implementing Anyterm):

– Supporting Opera and Konqueror is only for the brave or mad. Wait for a year or so, they’ll catch up.

– The XML bit is the least important. Anyterm does use XML, but only in a trivial way, and it might have been better to just send plain text. Browsers tend to mess up (“normalise”) the whitespace if you use XML. The ultimate thin browser applications would just eval() a lump of javascript sent in the response.

– Browsers differ greatly in their performance when running complex Javascript and updating pages via DOM. Test on all of them. Memory leaks are common.

– If you want a “push” channel from the server to the browser, have a look at how Anyterm does it.

Cheers!

–Phil.

Got Something To Say:

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

*

© Copyright Quentin Stafford-Fraser