I made a simple html to play with XHR, but get no response from httpxml.responseText;
But the script does work in the safari console.
<html><head></head><body>
<div id="myDiv"></div>
<button type="button" onclick="loadXMLDoc()">Change Content</button>
<script type="text/javascript">
function loadXMLDoc()
{
httpxml = new window.XMLHttpRequest;
httpxml.open('GET','resources/xml/test.xml',true);
httpxml.send();
text = httpxml.responseText;
alert(text);// there's no text in the alert window
document.getElementById("myDiv").innerHTML=text;
}
</script>
</body>
</html>
You should add the readyState test before.
But for this, I will use jquery, so easier :