GIF89a
function minus(qty_id,sprice_id,subtotal_id,prod_sr,prod_id){ var qty_val=$("#"+qty_id).val(); var sprice_val=$("#"+sprice_id).text(); var qty_val2=parseInt(qty_val)-1; if(qty_val>1) { var subTotal=parseInt(sprice_val)*parseInt(qty_val2); if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (this.readyState==4 && this.status==200) { if(this.responseText==2) { window.location.href = ("login.php"); } else if(this.responseText==4) { alert("Product is out of stock, You can't add into cart"); } else if(this.responseText==1) { $("#"+qty_id).val(qty_val2); $("#"+subtotal_id).text(subTotal); } } }; // ops 0 for decrement qty xmlhttp.open("GET","updateCart.php?sr="+prod_sr+"&qty="+qty_val2+"&price="+sprice_val+"&prod_id="+prod_id,true); xmlhttp.send(); } }