Sunday, October 25, 2009

AJAX

So here I was, thinking AJAX was some magical combination of various elements. Apparently not. At least, not on the client side. You just have an "XMLHTTPRequest" object that you
  1. define a field called onreadystatechange as a lambda function for what to do when the server hits you back,
  2. open() with options to
    • read or write, like a file,
    • locate the script running the server, and
    • whether or not to run asynchronously
  3. send() after you've opened.
There. Ignoring IE 5 and 6 (which every sane person should do), there's your API for a client side AJAX script.

1 comment:

  1. This has recently proven to be... not more complicated. But rather, the workings of setting up Apache to get it functioning are a lot more obfuscated, especially on a Mac.

    ReplyDelete