var itemtotal = parseFloat(words[1]).toFixed(2.0)*qty;
$.ajax({
type: 'POST',
url: 'cartitem.php',
data: {itemtotal:itemtotal},
success: function(data){
alert(data);
}
我想将每个AJAX调用的值添加到PHP数组中以供稍后处理。我怎么能这样做?
答案 0 :(得分:0)
php:
if (isset($_POST['itemtotal']))
{
$array = [];
if (is_numeric($_POST['itemtotal'])) {
//you need to do some validation here its just an example
array_push($array, $_POST['itemtotal']);
}
}
希望有所帮助