$('input.update').on('focus', function() {
$(this).data('val', $(this).val());
});
function sendvalue() {
// Array
var postData = [];
$('input.update').each(function() {
var inp = $(this);
postData.push({
previous: inp.data('val'),
currentvalue: inp.val(),
});
});
$.ajax({
type: "POST",
url: "updateedit.php",
data:postData,
success: function(data) {
alert(data);
},
error: function() {
alert('failed');
}
});
}
我的PHP页面
foreach($_POST['postData] as $value)
{
echo $value;
}
到PHP在我的php页面中,我得到错误为undefined index:postData以及如何检查脚本值是否被赋值
2017-06-01
arjun