GIF89a php
Current File : /home/hencockfreshchic/public_html/erp/js/saveRecord.js
function saveRecord(ops,srr)
{
	var uname=$("#uname").val();
	var mobb=$("#mobb").val();
	var state=$("#state").val();
	var city=$("#city").val();
	var type=$("#type").val();
	var adds=$("#adds").val();

	if(uname=="")
	{
		alert("Enter user name");
		$("#uname").focus();
		return false;
	}
	if(mobb=="")
	{
		alert("Enter mobile number");
		$("#mobb").focus();
		return false;
	}
	if(mobb.length!=10)
	{
		alert("Invalid mobile number");
		$("#mobb").focus();
		return false;
	}
	if(state=="")
	{
		alert("Enter state");
		$("#state").focus();
		return false;
	}
	if(city=="")
	{
		alert("Enter city");
		$("#city").focus();
		return false;
	}
	if(type=="")
	{
		alert("Select type");
		$("#type").focus();
		return false;
	}
	if(adds=="")
	{
		alert("Enter address");
		$("#adds").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.reload();
      }
      else
      {
      	alert("Unable to save data.");
      	window.location.reload();
      }
	}
  };

  if(ops==1)
  {
  	 xmlhttp.open("GET","saveRecord.php?uname="+uname+"&mobb="+mobb+"&state="+state+"&city="+city+"&type="+type+"&adds="+adds,true);
  }
  else
  {
  	 xmlhttp.open("GET","updateRecord.php?uname="+uname+"&mobb="+mobb+"&state="+state+"&city="+city+"&type="+type+"&adds="+adds+"&srr="+srr,true);
  } 
  xmlhttp.send();


}