Re: Rasmus' 30 second AJAX Tutorial - [was Re: [PHP] AJAX & PHP]
| From: | Rasmus Lerdorf | Date: | Sat, 23 Jul 2005 15:43:47 +0000 |
| Subject: | Re: Rasmus' 30 second AJAX Tutorial - [was Re: [PHP] AJAX & PHP] | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-219254@lists.php.net to get a copy of this message | ||
Chris Boget wrote:
>>function sndReq(action) {
>> http.open('get', 'rpc.php?action='+action);
>> http.onreadystatechange = handleResponse;
>> http.send(null);
>>}
>
>
> So with AJAX, the data gets sent back to the browser using GET?
> Is there any way you can do it using POST?
The prototype for the http.open method looks like this:
open("method","URL",async,"uname","pswd")
So to do a POST request instead, just use 'post' instead of 'get' in the
first argument. Then put the url encoded post data in the http.send() call.
-Rasmus