GIF89a php
Current File : /home/hencockfreshchic/public_html/admin.cpanel/uploadjs/updateCommission.js
function updateCommission(sr){
	document.getElementById("overlay").style.display = "block";
	var cat=$("#cat").val();
	var subcat=$("#subcat").val();
	var prod=$("#prod").val();
	var percent=$("#percent").val();

	if(cat==""){
		document.getElementById("overlay").style.display = "none";
		alert("Select Category");
		$("#cat").focus();
		return false;
	}
	if(subcat==""){
		document.getElementById("overlay").style.display = "none";
		alert("Select Sub Category");
		$("#subcat").focus();
		return false;
	}
	if(prod==""){
		document.getElementById("overlay").style.display = "none";
		alert("Select Product");
		$("#prod").focus();
		return false;
	}

	
   if (percent == "")
   {
   	document.getElementById("overlay").style.display = "none";
      alert("Enter commission");
      $("#percent").focus();
      return false;
   }
   if (percent.length < 1)
   {
   	document.getElementById("overlay").style.display = "none";
      alert("Enter commission");
      $("#percent").focus();
      return false;
   }
   if (percent.length > 5)
   {
   	document.getElementById("overlay").style.display = "none";
      alert("Enter commission");
      $("#percent").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)
      {
      	document.getElementById("overlay").style.display = "none";
	      alert("Commission has been updated on the particular product");
	      window.location.href = ("addCommision.php");
      }
      else
      {
      	document.getElementById("overlay").style.display = "none";
      	alert("Failed to update commission");	     
      }
	}
  };


  xmlhttp.open("GET","updateCommission.php?cat="+cat+"&subcat="+subcat+"&prod="+prod+"&percent="+percent+"&sr="+sr,true);
  xmlhttp.send();
	
}