<form action="" method="post" value="1" class="block" id="form">
<div class="block-txt">
<p class="num">-450 000 ₽</p>
<p class="desc">Скидка в кредит</p>
</div>
<!--<input type="checkbox">-->
<input type="number" name="num" style="width: auto;">
<button type="submit" name="type" value="1" class="row-discounts_block_button">
</button>
</form>
<script>
jQuery("#form").on("submit", function(){
jQuery.ajax({
url: '',
method: 'post',
dataType: 'html',
data: jQuery(this).serialize(),
success: function(data){
//jQuery('#product-price').html(data);
// jQuery('#product-price').html('data');
}
});
return false;
});
</script>
<?php
if (isset($_POST['type']) and $_POST['type'] == 1) {
echo $_POST['num'];
/*$product_price = $product_price-450000;*/
};
?>
Не выполняется php код после добаления ajax
Менял способы добавления ajax в обработку формы, без него работает форма само собой …………………………………………………………………………………………………………………………………………………………………………..
New contributor
FantomIT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.