hi all,
Im new to ajax.. please bear with me.. My code is as follows:

Code:
function checkempid(){ 
		
		var status;
		xmlHttp=GetXmlHttpObject();
		var urlemp="postemployee";
		urlemp=urlemp+"?employeeId="+document.PostAvailableBench.employeeId.value;
		xmlHttp.onreadystatechange=stateChangedemp ;
		xmlHttp.open("GET",urlemp,true);
		xmlHttp.send(null);
		var showdata;
		
		function stateChangedemp(){ 
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		showdata = xmlHttp.responseText;
		alert(showdata);
		    
		 if(showdata.trim()=="available"){
			alert("inside if");
		   saveReportFinished(true);
	    }
	    else{
	    	alert("inside else");
	        saveReportFinished(false); 
	    	}
		}
		}

		function saveReportFinished(success) {
			if (success == true)
			{
			status = true;
		    }
			else
			{
			status = false;
			}
		}
		    
		function GetXmlHttpObject(){
		var xmlHttp=null;
		try{
		  xmlHttp=new XMLHttpRequest();
		 }
		catch (e) {
		 try {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		 catch (e){
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		 }
		return xmlHttp;
    }
		
		return status;
}
Im trying to set the 'status' which is a global variable inside 'saveReportFinished' function and trying to return the status by using 'return status'.. but it returns only the initial value and does not return the values in saveReportFinished function. I will be glad if someone could help me.. Thank You in advance!