var xhr=xhr();
function xhr(){
if(window.XMLHttpRequest){
return window.XMLHttpRequest();
}else if(window.ActiveXObject){
return new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
try{
return new ActiveXObject("Msxml2.XMLHTTP");
}catch (ex){}
}
}
}
xhr.open("get","url","true");
xhr.onreadystatechange=function(){
if(xhr.readyState==4&&(xhr.status==200||xhr.status==304)){
document.getElementById("myDiv").innerHTML=xhr.responseText;
}
}
xhr.send();