I'm tring to send a JSON
to a PHP
page via jQuery
, but it doesn't work properly:
json_data = {};
json_data.my_list = new Array ();
$('#table_selected tr').each (function (i) {
json_data.my_list.push ({id:$(this).attr("id")});
});
$.post ("my_page.php", json_data, function (response) {
if (response) alert("success");
else alert("error");
});
<?php
// this is my_page.php
$json = json_decode (stripslashes ($_REQUEST['my_list']), true);
echo var_dump($json);
?>
This returns NULL
to my callback
, where I'm wrong?