/************************************************************************************ AJAX QUEUE This is a pretty basic class that encapsulates the "seminal" AJAX functionality into an object. It also gets around the "single-threaded" nature of your standard HTTP request by "queueing" requests, so they happen one after the other. Javascript is a pretty pathetic language when it comes to handling multiple concurrent tasks. It doesn't. Javascript can only do one thing at a time, so most of the complexity of this class is around making sure that we don't cram too much stuff into the pipe. HTTP will allow multiple concurrent HTTPRequests (threading), but there's a lot less of a reason for taking advantage of this than the hype would have you believe. An HHTPRequest can be a slow process, especially if you are on a dicey connection (such as a dial-up or GPRS modem). Reliability and responsiveness definitely become factors. This class is all about reliability. It handles complexity by setting up a queue. Responsiveness is up to you, in your design. A good AJAX backbone and $2.50 will get you a Venti Lattˇ at Starbucks. It needs to be combined with sensible, user-centered design. This supports both POST and GET. When using either one, simply pass a URL in standard form, with parameters assigned by equals (=), and separated by ampersands (&). If the selected method is a POST, the calling function will strip the parameters from the URL and pass them in separately. The way you use this is to create a Javascript function that is a "callback." This is a function that will be called when the XML HTTP request task is complete. The function is very simple. It is simply a function with one (string) parameter, and one parameter that can be whatever you need. You can also set up a "partial" callback, so that you get a call before the request has completed. I saw some discussion complaining that this wasn't some sort of "threading" or "high-level complete AJAX solution." Well it ain't. Learn to accept the fact and move along. This is, for the most part, a "driver." It's about equivalent to the "Transport" layer in the OSI model. You could easily use this as the basis for "threading" if you so desire. The reason that I wrote this was to give me a rock-solid "baseline" for my AJAX. I don't use that much AJAX. I think that, like so many other "buzzwords," it has been stretched to ridiculous levels. However, when I do use it, I want it to be very reliable. This class gives me easy, reliable AJAX. You must use the existing instance of this class, calling it with a pointer to the callback. The browser sends the request to the server, which churns away for a while, then calls your browser back by calling the function you sent it. The parameter will be a string provided by the server. You will probably need to write special code on the server to support these calls. The string can be anything. I usually use HTML for things like