I'm stucked here for an hour now, I've searched in some topics on stackoverflow but nothing.
I have this script
<script type="text/javascript">
$('.qty').keyup(function () {
var $me = $(this),
$parent = $me.parent('div'),
total = parseInt($me.attr("data-price"));
if (isNumber($me.val()) && $me.val() > 0) {
total = total * $me.val();
}
$parent.find('.price').html(total);
updateTotal();
});
function isNumber (n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
function updateTotal () {
var total = 0;
$('.qty').each(function () {
var $me = $(this);
if (isNumber($me.val()) && $me.val() > 0) {
total += $me.val() * parseInt($me.attr("data-price"));
}
});
$('#total').text(total);
$.ajax({
type:'POST',
url:'./s.php',
data:'price='+total,
success: function(data){
alert(data);
}
});
}
updateTotal();
</script>
I want to send the price to the s.php page from the same folder but when I type echo $_POST['price'];
I get the undefined index error. var_dump($_POST['price'])
returns null. The result from the pop-up page is good, but is not passed to that page.