Here is the Javascript AJAX code:
var anything=document.getElementById("textarea").val;
I have Javascript AJAX implemented:
httpRequest.open('POST',anyURL,true);
http.send(anything);
Now, my question is since this is the post data, and this is not actually associated with any html tag or id, how do I receive this in php?
<?php
$parameter=$_POST[' '];
?>
What should I put in the white space there?
Add a new variable and use JSON.stringify on your anything variable that was turned into a key value pair.
var anything={myTextArea: document.getElementById("textarea").value};
var JSONstr = JSON.stringify(anything);
PHP:
<?php
$parameter=$_POST['JSONstr'];
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.