The XMLHTTPRequest object has a little-used, but still useful property: The ability to post data instead of passing data completely in the URI as a GET. The post method comes in handy when you need to process large chunks of data, greater than the size limit on get requests, or when you need greater security between the client and server. You do not, after all, want to pass a social security number or a credit card number and have that information recorded in your web server log files.
The good news is that setting up a POST method takes only a few more lines of code than a GET method. We'll start with three variables we'd like to pass back to the server.
var age=37; var name='John Doe'; var job='Dog Catcher';
The method for preparing the data for transfer is the same as for setting up a GET save we do not include the http:// and website (www.somedomain.com) at the beginning of the data. We still must escape the data and seperate the data fields with ampersands (&).
var passData = 'age='+escape(age)+'&name='+escape(name)+'&job='+escape(job);