var xmlhttp; function LoadXmlDoc(url){ xmlhttp = null; if(window.XMLHttpRequest){ //code for all new browsers xmlhttp=new XMLHttpRequest(); }else if(window.ActiveXObject){//IE5 and IE6 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } if(xmlhttp!=null){ xmlhttp.onreadystatechange=function (){ if(xmlhttp.readyState==4){ // loaded ... if(xmlhttp.state==200){ //success,...our code here ... }else{ alert('Problem retrieving XMl data'); } } } } }