Home > Uncategorised > AJAX


Having spent ages writing a post on Adaptive Path’s description of what AJAX is, I’ve discovered that my friend Richard is also in on the game, and has managed to write a back end for it using Lisp.

I’m still not convinced that it is the be-all and end-all of the Web, but it’s certainly a step in the right direction. To illustrate what I mean, you have to look at some of the things that I was working on today. Somebody had introduced a bug into our system because they had not considered what happened when an incorrect value would be entered by the user. This causes a load of fields to appear, which shouldn’t have appeared (they should have appeared based on the properties of an item they entered into a different field). It then took me the best part of an hour and a half to rectify this simple slip up.

OK, you’re going to get issues with this in “real” programming (I’m talking native stuff here), but never the less, the chances of it happening are increased using this method.

Interestingly, there is already an Open Source package to do a lot of this interaction for you, in the shape of “SAJAX

Categories: Uncategorised Tags: , ,
  1. Rich
    March 8th, 2005 at 18:04 | #1

    Just been released, by the way.

    CL-AJAX is modelled on SAJAX

    Essentially you can call server-side functions from the client Javascript, which is very cool. Only this is in Common Lisp, not PHP!

    All you have to do is export a function:

    (export-function ‘my-function)

    Include some generated text into the top of your page:

    (build-preamble "http://www.holygoat.co.uk/functions/&quot😉

    define a callback in Javascript to handle the returned response:

    function myCallback() { … }

    then call:

    ajax_my_function(whatever_params_it_took, myCallback, true);

    voila! Your callback gets hit with the result of calling my-function, in this case expecting the result as XML. The ajax_my_function JS is automatically generated from the Lisp function. No manually generating URLs! Hurrah!

  1. No trackbacks yet.