🔒 Closed PAHELP LNG

Status
Not open for further replies.

iamjefjef23

Forum Guru
if('<?= $available > 0 ?>' == 1){
start_loader()
$.ajax({
url:base_url+"classes/Master.php?f=save_to_cart",
method:'POST',
data:{product_id: '<?= isset($id) ? $id : "" ?>',quantity:1},
dataType:'json',
error:err=>{
console.error(err)
alert_toast("An error occured","error")
end_loader();
},
success:function(resp){
if(resp.status =='success'){
update_cart_count(resp.cart_count);
alert_toast("Product has been added to cart.",'success')
}else if(!!resp.msg){
alert_toast(resp.msg,'error')

}else{
alert_toast("An error occured","error")
}
end_loader();
}
})
}

anong idadag ko mga idol para pag 0 yung $available is mag aalert sya na "No Stock Available"
 
di mo po ba siya pwedeng gawan nalang ng condition directly sa php code like:
PHP:
<?php
$available = 1;

if($available <= 0){
?>
// Javascript code here ganon
    
<?php } else { ?>
// ibang condition dito
?>
 
Status
Not open for further replies.

About this Thread

  • 3
    Replies
  • 590
    Views
  • 3
    Participants
Last reply from:
vanisher143

Online now

Members online
1,009
Guests online
707
Total visitors
1,716

Forum statistics

Threads
2,275,595
Posts
28,964,342
Members
1,231,881
Latest member
spoting
Back
Top