GIF89a php
Current File : /home/hencockfreshchic/public_html/erp/js/validateForm1.js
// JavaScript Document
function ValidateForm1(ops,sr)
{  
   var mob=$("#mob").val();
   var emailid=$("#emailid").val();
   var pwd=$("#pwd").val();

  if(mob=="")
  {
   alert("Enter username");
   $("#mob").val();
   return false;
  }

  if(emailid=="")
  {
   alert("Enter email id");
   $("#emailid").val();
   return false;
  }

  if(pwd=="")
  {
   alert("Enter password");
   $("#pwd").val();
   return false;
  }


// calling api if successfully got results
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("New Admin user created"); 
         }
         else if(ops==2)
         {
            alert("Selected Admin details has been updated"); 
         }
         window.location.href = ("adminUsers.php");             
      }
      else
      {
            alert("Unable to update user details");        
      }
      
   }
};

if(ops==1)
{
xmlhttp.open("GET","insertPackages.php?mob="+mob+'&pwd='+pwd+"&email="+emailid,true);
}else
{
xmlhttp.open("GET","UpdatePackages.php?mob="+mob+'&pwd='+pwd+'&sr='+sr+"&email="+emailid,true);
}
xmlhttp.send();

}