GIF89a
function savePriority(ops){ var pname=$("#pname").val(); var plevel=$("#plevel").val(); var psr=$("#psr").val(); if(pname=="") { alert("Invalid product name"); $("#pname").focus(); return false; } if(plevel=="") { alert("Choose priority level"); $("#plevel").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) { if(ops=="1") { alert("Priority has been set on the given product successfully"); window.location.href = ("priority.php"); } else { alert("Priority has been updated on the given product successfully"); window.location.href = ("priority.php"); } } else if(this.responseText==2) { alert("Already priority set on this product. \n Suggestion : Remove product from table or Update from table"); window.location.href = ("priority.php"); } else if(this.responseText==0) { if(ops=="1") { alert("Error : Unable to set priority on the given product \n For more information contact to developer"); } else { alert("Error : Unable to update priority on the given product \n For more information contact to developer"); } } } }; if(ops==1){ xmlhttp.open("GET","savePriority.php?sr="+psr+"&plevel="+plevel+"&pname="+pname,true); xmlhttp.send(); } else { var psr2=$("#psr2").val(); xmlhttp.open("GET","updatePriority.php?prod_id="+psr+"&plevel="+plevel+"&pname="+pname+"&sr="+psr2,true); xmlhttp.send(); } }