Just a few notes to make on this...
I am new to this whole AJAX thing, so forgive me if i am pointing out something obvious.
1) When we are calling the open method of the http_request instance (http_request.open()) why are we specifing 'POST' as the HTTP method as the first parameter? Shouldn't it be 'GET' if we are to pass it a URL with a querystring? (as shown in the article)
2) Also, I am confused as to exactly how the server response is to send data back? Will the requested page on the server do processing depending on the data in the querystring it is passed, and then return this data? If so, how is the data passed back? Or does the whole content of a page (eg HTML) get sent back for the JS function to process?
An example of a called page sitting on the server in which the http_request object function is calling would have been useful.
Re 1) When you POST, you are again sending data from the browser to the server. This data is again formatted as a query string (e.g. "name=value&foo=bar"), only it's not visible in the browser. Well in the case of an XMLHTTPRequest the GETs are also not displayed in the browser, but that was just to clarify.
In any event if you want to post, you'll do:
http_request.open('POST', 'http://example.org/somepage.php', true); http_request.send('name=value&foo=bar');
If you want to GET: http_request.open('GET', 'http://example.org/somepage.php?name=value&foo=bar', true); http_request.send(null);
Hope this helps, Stoyan