Found a premade PHP class for doing just this with a quick Google search:
I am still awaiting a response from Gregory, and will post that in time as well, as the AJAX framework used in the script you are using should work fine with some tweaking (I think).
MIKE