GIF89a
function saveColorVariants(){ var color_name=$("#color_name").val(); var color_unit=$("#color_unit").val(); if(color_name=="") { alert("Enter name of color, Given name of color will show during product listing page"); $("#color_name").focus(); return false; } if(color_unit=="") { alert("Enter color measurement unit, Given measurement will show on website so please fill it carefully, otherwise UI on website may be impact"); $("#color_unit").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("Added new color variant successfully"); window.location.href = ("new_color.php"); } else if(this.responseText==2) { alert("Dear user, This color already exist in database, Please try again with different color variant"); window.location.href = ("new_color.php"); } else if(this.responseText==0) { alert("Dear user, We are unable to save new color variant now, please contact to developers to resolve this issue"); } } }; xmlhttp.open("GET","saveColorVariants.php?color_name="+color_name+"&color_unit="+color_unit,true); xmlhttp.send(); }