我特林通過jQuery
到JSON
發送到PHP
頁,但它不能正常工作:發送JSON到PHP
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);
?>
這將返回NULL
我callback
,在那裏我錯了?