I am stuck a long time with trying to send a JSON
from javascript
to a PHP
script : the sending is fine (I can see the JSON
in fiddler) yet I receive nothing in the PHP script
:
javascript
:
var person = {
name: 'yoel',
age: 28
};
xmlhttp.open("POST","http://localhost:8888/statisticsdb.php",true);
xmlhttp.setRequestHeader("Content-Type", "application/json");
xmlhttp.send(JSON.stringify(person));
php
:
echo 'trying to print ' . var_dump($_POST["name"]);
I would expect obviously to see SOMETHING but var_dump returns nothing. Help would be much appreciated!