GIF89a php
Current File : /home/hencockfreshchic/public_html/erp/js/saveExpense.js
function saveExpense(ops,srr)
{
  var typee=$("#type").val();
	var datee=$("#datee").val();
	var amount=$("#amount").val();

	
	if(typee=="")
	{
		alert("Select expense type");
		$("#type").focus();
		return false;
	}
  if(datee=="")
  {
    alert("Select date");
    $("#datee").focus();
    return false;
  }
	if(amount=="")
	{
		alert("Enter amount");
		$("#amount").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","saveExpense.php?typee="+typee+"&amount="+amount+"&datee="+datee,true);
  	}
  	else
  	{
  		xmlhttp.open("GET","updateExpense.php?typee="+typee+"&amount="+amount+"&srr="+srr+"&datee="+datee,true);	
  	}
  xmlhttp.send();

}