Simple Ajax Function

function AjaxCall(URL,divId){
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.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.getElementById(divId).innerHTML=xmlHttp.responseText;
}
else
{
//document.getElementById(divId).innerHTML="Loading...";
}
}

xmlHttp.open("GET",URL,true);
xmlHttp.send(null);
}

To call the ajax function pass the server site page url and div id
AjaxCall("test.php","div_test");