GIF89a php
Current File : /home/hencockfreshchic/public_html/js/placeOrder.js
function placeOrder(user_id,isBulk){
	document.getElementById("overlay").style.display = "block";
	if(document.getElementById('paypal').checked || document.getElementById('cash').checked){
	if (document.getElementById('cash').checked){

					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";
			      	alert("Dear customer, Your order as COD has been placed");			      
			      	window.location.href = ("order-complete.php");
			      }
			      else if(this.responseText==0){
			      	document.getElementById("overlay").style.display = "none";
			      	alert("Dear customer, No product found for COD. \n Please try again.");
			      }
			      else if(this.responseText==2)
			      {
			      	document.getElementById("overlay").style.display = "none";
			      	window.location.href = ("login.php");	
			      }
			       else if(this.responseText==3)
			      {
			      	document.getElementById("overlay").style.display = "none";
			      	alert("Dear Customer, No product found for COD");	
			      }
			      else if(this.responseText==5)
			      {
			      	document.getElementById("overlay").style.display = "none";
			      	alert("Dear Customer, Some item in cart exceeding more than stock value, please review order below exist stock");	
			      }
			      else if(this.responseText==6)
			      {
			      	document.getElementById("overlay").style.display = "none";
			      	alert("Dear Customer, You cant order today");	
			      }
				}
			  };
			  console.log("placeCOD.php?user_id="+user_id+"&isBulk="+isBulk);
			  xmlhttp.open("GET","placeCOD.php?user_id="+user_id+"&isBulk="+isBulk,true);
			  xmlhttp.send();

	} else if(document.getElementById('paypal').checked)
	{
		document.getElementById("overlay").style.display = "none";
		window.location.href = ("placeCash.php?user_id="+user_id+"&isBulk="+isBulk);	
	}
	}
	else
	{
		document.getElementById("overlay").style.display = "none";
		alert("Dear customer, Please select atleast one of the below option to proceed your order");
	}
}