GIF89a
function applyCommission(){ 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 applied on the particular product"); window.location.href = ("addCommision.php"); } else if(this.responseText==2) { document.getElementById("overlay").style.display = "none"; alert("Commission already applied on this product"); window.location.href = ("addCommision.php"); } else { document.getElementById("overlay").style.display = "none"; alert("Failed to apply commission"); } } }; xmlhttp.open("GET","applyCommission.php?cat="+cat+"&subcat="+subcat+"&prod="+prod+"&percent="+percent,true); xmlhttp.send(); }