GIF89a php
Current File : /home/hencockfreshchic/public_html/js/subscribe.js
function subscribe(){

	var emailid=$("#emailid").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");
      	window.location.reload();
      	document.getElementById("newslater-popup").style.display = "none";
      }
      else if(this.responseText==2)
      {
      	alert("Dear user, You have already subscribed our portal. \n Please stay updated with our services in future");
      	document.getElementById("newslater-popup").style.display = "none";
      }
      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();

}