Here is a nice AJaX pattern:
In most samples that I have seen so far, a global XMLHttpRequest variable is declared, since you cannot pass variables to the action handler.
In this article, they show a nice pattern, where you declare an anonymous function that calls another named function which may accept parameters; like this:
http_request.onreadystatechange = function(){ do_the_thing(http_request); };
This is particularly useful if you need to send of multiple XHRs without being able to gurantee the order in which they return.
Thanks to Joan Morris DiMicco for finding this.
Copyright by Gerald Beuchelt.
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
In addition, my opinions can change. This weblog provides a momentary snapshot of such opinions. Existing posts that were written in the past do not necessarily reflect my current thoughts and opinions.
For the purposes of attribution, the author is "Gerald Beuchelt" and attribution shall provide a (clickable, where possible) URL to this site.
© 2008, Gerald Beuchelt
E-mail