GIF89a php
Current File : /home/hencockfreshchic/public_html/js/applyCouponCode.js
function applyCouponCode()
{
	var coupon=$("#coupon").val();

	if(coupon=="")
	{
		alert("Enter coupon code");
		$("#coupon").focus();
		return false;
	}
	if(coupon.length<2)
	{
		alert("Invalid coupon code");
		$("#coupon").focus();
		return false;
	}

	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)
      {
      	alert("Coupon code has been applied successfully.");
        window.location.reload();
      }
      else if(this.responseText==3)
      {
        alert("Coupon already has been applied.");
      }
      else
      {
      	alert("No coupon code found on these products");
      }	
	}
  };
  xmlhttp.open("GET","applyCouponCode.php?coupon="+coupon,true);
  xmlhttp.send();

}