GIF89a php
Current File : /home/hencockfreshchic/public_html/js/addCart2.js
function addCart2(prod_id,user_id,sale_price)
{	
  var qty=$("#qty").val();
  
//var cartCount=parseInt($("#cartCount").text());
document.getElementById("overlay").style.display = "block";
	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==1)
      {
      	 document.getElementById("overlay").style.display = "none";
        window.location.reload();

      }
      else if(this.responseText==0)
      {
      	 document.getElementById("overlay").style.display = "none";
      	alert("Error : Unable to add item");
      }
      else if(this.responseText==2)
      {
      	 document.getElementById("overlay").style.display = "none";
      	window.location.href = ("login.php");
      }
      else if(this.responseText==4)
      {
         document.getElementById("overlay").style.display = "none";
        alert("Product is out of stock, You can't add into cart");
      }
       else if(this.responseText==5)
      {
         document.getElementById("overlay").style.display = "none";
          var x = document.getElementById("snackbar");
          $("#snack_msgg").html("Dear Customer, You cant add in cart today.");
          x.className = "show";
        setTimeout(function(){ x.className = x.className.replace("show", "Hello"); }, 2500);
        
      }
	}
  };
  xmlhttp.open("GET","addCart.php?prod_id="+prod_id+"&user_id="+user_id+"&sale_price="+sale_price+"&qty="+qty,true);
  xmlhttp.send();
}