GIF89a
function subscribNews(){ var emailid=$("#email2").val(); var regexp; regexp = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i; if (!regexp.test(emailid)) { alert("Invalid email id"); $("#emailid").focus(); return false; } if (emailid == "") { alert("Enter email id"); $("#emailid").focus(); return false; } if (emailid.length < 6) { alert("Email id minimum limit required 6 words"); $("#emailid").focus(); return false; } if (emailid.length > 100) { alert("Enter email id"); $("#emailid").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("Dear user, You subscribed us successfully, \n For more information visit your email inbox"); $("#email2").val(""); } else if(this.responseText==2) { alert("Dear user, You have already subscribed our portal. \n Please stay updated with our services in future"); $("#email2").val(""); } else if(this.responseText==0) { alert("Error : We are unable to subscribe you at our panel at this time, \n Please try again later"); } } }; xmlhttp.open("GET","saveSubscribers.php?emailid="+emailid,true); xmlhttp.send(); }