In your first block you test for
window.XMLHttpRequest
On my chrome this is set but your code does nothing unless its not set. Simply moving the end else bracket gets code I think you need.
function load(){
if(window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
}else{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState == 4 && xmlhhtp.readyState == 200){
document.getElementById("adiv").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","include.inc.php",true);
xmlhttp.send();
}
Running the function then correctly gets a 404 (For the the WDF server)
load()
undefined
VM145:13 GET https://www.webdesignerforum.co.uk/topic/include.inc.php 404
load @ VM145:13
(anonymous) @ VM163:1
VM145:8 Uncaught ReferenceError: xmlhhtp is not defined
at XMLHttpRequest.xmlhttp.onreadystatechange (<anonymous>:8:35)
xmlhttp.onreadystatechange @ VM145:8
XMLHttpRequest.send (async)
load @ VM145:13
(anonymous) @ VM163:1
So you just needed to actually do somthing in browsers where window.XMLHttpRequest is set.