var xmlHttp = createXmlHttpRequestObject();

function createXmlHttpRequestObject(){
	var xmlHttp;
	if (window.ActivexObject){
		try{
			xmlHttp = ActivexObject("Microsoft.XMLHTTP");
		}catch (e){
			xmlHttp = false;
		}
	}else{
		try{
			xmlHttp = new XMLHttpRequest();
		}catch (e){
			xmlHttp = false;
		}
	}
	if (!xmlHttp) {
		display("Error creating the XMLHttpRequest object.");
	}else{
		return xmlHttp;
	}
}

function process(id){
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
		// code to get value here
		//display("Please wait.....");
		xmlHttp.open("GET", "action_activity.php?id=" + id, true);
		xmlHttp.onreadystatechange = handleServerResponse;
		xmlHttp.send(null);
	}else{
		setTimeout('process('+ id +')', 1000);
		
	}
}

function display($message){
	$("#infodata").html($message);
}

function handleServerResponse(){
	
	if (xmlHttp.readyState == 4){
	
		if (xmlHttp.status == 200){
			var response = xmlHttp.responseText;
			display(response);
			setTimeout('process('+ id +')', 1000);
		}else{
			display("There was a problem accessing the server: " + xmlHttp.statusText);
		}
	}
}