I send data from javascript to PHP like this:
$.ajax({'url': 'my.php',
'type': 'POST',
'data': JSON.stringify(update_data),
'success': function(response) {
alert(response);
}
});
Using HTTPFOX Firefox plug-in I see the following data in the POST DATA tab:
{"file_id":["1","2","3"],"description":["lala","kuku","wow!"],"tags":[["julia","paper"],["Very nice car"],[]]}
however, if I do in my.php print_r($_POST) I see an empty array. Why is that ? How could I collect the data ?
The data needs to be in the form name=value.
try…
Then you should have your json string in
$_POST['mydata']You’ll then need to use
json_decodeto actually get at the individual values in your string.http://php.net/manual/en/function.json-decode.php