function updatePrice(ServiceID, Quantity, PostsCount) {
kupon = $('#order_kupon').val();
var dataString = 'action=get-price&service-id='+ServiceID+'&quantity='+Quantity+'&postsCount='+PostsCount+'&kupon='+kupon;
if(Quantity > 0) {
$.ajax({
type: "POST",
url: "requests.php",
data: dataString,
cache: false,
success: function(data){
if(data) {
$("#price").html(data);
}
}
});
} else {
$("#price").html(0);
}
}
$('#order_kupon').on('change', function() {
updatePrice();
});
function updateKupon() {
$.ajax({
type: "POST",
url: "requests.php",
data: {
action: 'get-kupon',
kupon: $('#order_kupon').val()
},
cache: false,
success: function(data){
if(data) {
$("#skidka").html(data);
$("#skidka2").html(data);
}
}
});
}
if(GetAction('get-price')) {
$user->IsLogged();
$price = $orders->GetPrice($_POST['service-id'], $_POST['quantity']);
echo $price." руб";
}
if(isset($_POST['action']) && $_POST['action'] == 'get-kupon') {
$kupon = $_POST['kupon'];
$gdfdfg = mysql_query("SELECT * FROM `kupon` WHERE `kupon`='$kupon' AND `ostatok`>'0'", $db);
$num_kup = mysql_num_rows($gdfdfg);
if($num_kup > 0) {
$sqlh = mysql_query("SELECT * FROM `kupon` WHERE kupon='$kupon'", $db);
$resultz=mysql_fetch_array($sqlh);
$skidka = $resultz['procent'];
echo $skidka.'%';
} else {
echo '0 %';
}
}
<h5 class="uppercase">Спишется: <span id="price">0 <?php echo $currency; ?> </span> <i class="fa fa-repeat" style="cursor: pointer;"></i></h5>
function updatePrice(ServiceID, Quantity, PostsCount) {
var dataString = 'action=get-price&service-id='+ServiceID+'&quantity='+Quantity+'&postsCount='+PostsCount;
if(Quantity > 0) {
$.ajax({
type: "POST",
url: "requests.php",
data: dataString,
cache: false,
success: function(data){
if(data) {
$("#price").html(data);
}
}
});
} else {
$("#price").html(0);
}
}
if(GetAction('get-price')) {
$user->IsLogged();
$price = $orders->GetPrice($_POST['service-id'], $_POST['quantity']);
echo $price;
}