Parsing AJAX post data -- The Way

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



m5@xxxxxxxxxxxxxxxx / 2007-01-24 23:41:19 -0700:
Just wondering what smart people do for parsing data sent by the Javascript XMLHTTP object--e.g., http.send("post",url,true)...

In a normal form submit, the $_POST global nicely allocates form elements as array elements automatically. But with the AJAX way, the data get stuffed inside $HTTP_RAW_POST_DATA as a string, thereby making extraction more tedious.

Try setting this header before sending your Ajax request:

http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

Then $_POST should have an array, as expected. But $HTTP_RAW_POST_DATA will not be available.

--

_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux