<script type="text/javascript">
if (window.XMLHttpRequest)
xmlhttp=new XMLHttpRequest();
else if (window.ActiveXObject)
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange=state_Change;
xmlhttp.open("GET",url,true);
alert("Your browser does not support XMLHTTP.");
if (xmlhttp.readyState==4)
document.getElementById('T1').innerHTML=xmlhttp.responseText;
alert("Problem retrieving data:" + xmlhttp.statusText);
<body onload="loadXMLDoc('/example/xdom/test_xmlhttp.txt')">
<div id="T1" style="border:1px solid black;height:40;width:300;padding:5"></div><br />
<button onclick="loadXMLDoc('/example/xdom/test_xmlhttp2.txt')">Click</button>