after you get the response just do call this function to append data to your body element
function createDiv(responsetext)
{
var _body = document.getElementsByTagName('body')[0];
var _div = document.createElement('div');
_div.innerHTML = responsetext;
_body.appendChild(_div);
}
@satya code modified as below
function httpGet(theUrl)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
createDiv(xmlhttp.responseText);
}
}
xmlhttp.open("GET", theUrl, false);
xmlhttp.send();
}