var myData = JSON.stringify($('form').serializeArray());
$.ajax({
cache: false,
url: "http://localhost/Demo/store.php",
type: "POST",
data: myData,
complete: function (xhr, status) {
if (status === 'error' || !xhr.responseText) {
alert(status);
}
else {
var r = xhr.responseText;
}
}
});
$decoded = json_decode($_REQUEST['myData'],true);
print_r($_REQUEST);
exit;
if (is_array($decoded))
{
foreach ($decoded as $value) {
echo $value["name"] . "=" . $value["value"];
}
}
当我试图解码 php 中的数据时,错误是 undefined index myData ..请帮助我..谢谢。