When a GET request is being sent, all parameters are part of the URL. For POST, however, this data is sent in the body of the HTTP request. To do that with the XMLHttpRequest object, the parameters must be provided in the send() method. There is one caveat, though: If you want to access these parameters on the server side, the correct Content-type HTTP header must be set. This is done by using the setRequestHeader() method in the following fashion: Sending a POST Request (xmlhttppost.html)
The script posts to the URL post.php, which is a simple PHP script just returning the data: The Target PHP Script of the POST Request (post.php)
Of course, you can provide any other script in any other server-side technologyor you just POST to a plain text file. |