Return the data from the Ajax

function AjaxReturn(URL){
var xmlHttp;
try
{
xmlHttp=new XMLHttpRequest();
}catch (e) {
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}catch (e){
return false;
}
}
}
xmlHttp.open("GET",URL,false);
xmlHttp.send(null);
return xmlHttp.responseText;
}

To call the AjaxReturn function you need to pass the server site page url
var response = AjaxReturn("test.php");

The response data will be returned. Then you can manipulate according to your needs