GIF89a php
Current File : /home/hencockfreshchic/public_html/app_old/js/saveReg.js
function saveReg()
{
	var uname=$("#uname").val();
	var mobb=$("#mobb").val();
	var email=$("#email").val();
	var pwdd=$("#pwdd").val();
	var cpwdd=$("#cpwdd").val();
	

	if(uname=="")
	{
		showToast("Enter your name");
		$("#uname").focus();
		return false;
	}
	if(mobb=="")
	{
		showToast("Enter mobile number");
		$("#mobb").focus();
		return false;
	}
	if(mobb.length!=10)
	{
		showToast("Invalid mobile number");
		$("#mobb").focus();
		return false;
	}
	if(email=="")
	{
		showToast("Enter email id");
		$("#email").focus();
		return false;
	}
	if(pwdd=="")
	{
		showToast("Enter password");
		$("#pwdd").focus();
		return false;
	}
	if(pwdd.length<6 || pwdd.length>25)
	{
		showToast("Invalid password length");
		$("#pwdd").focus();
		return false;
	}
	if(cpwdd=="")
	{
		showToast("Enter confirm password");
		$("#cpwdd").focus();
		return false;
	}
	if(pwdd!=cpwdd)
	{
		showToast("Invalid confirm password");
		$("#cpwdd").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)
      {
      	window.location.href = ("dashboard.php");
      }
      else if(this.responseText==2)
      {
      		showToast("You are already register"); 
      		window.location.href = ("log.php");     		
      }
      else
      {
      		showToast("Facing network issue. Try again later.");
      }	
	}
  };
  xmlhttp.open("GET","saveReg.php?uname="+uname+"&mobb="+mobb+"&email="+email+"&pwdd="+pwdd,true);
  xmlhttp.send();

}


function showToast(msgg)
{
	var x = document.getElementById("snackbar");
	      	$("#snack_msgg").html(msgg);
 			 x.className = "show";
  			setTimeout(function(){ x.className = x.className.replace("show", "Hello"); }, 3000);
}