well, being obsessive like i am, i wanted to see if it did work, so i wrote it out and chucked it on my apache server and it worked fine for me.
Sample1.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<root>
No
</root>
index.html
<html>
<head>
<title>Ajax Testing</title>
</head>
<script language="javascript">
//Set default http_request to false for initiation
var http_request = false;
function request(url)
{
http_request = false;
// Mozilla, Safari, Opera and all other browsers use this request
if (window.XMLHttpRequest)
{
http_request = new XMLHttpRequest();
/*
NOTE:
Some versions of the mozilla browsers won't work if the response from the **Missing comment**
In order to fix this, we can use an extra function to override the header **missin comment**
*/
if (http_request.overrideMimeType)
{
http_request.overrideMimeType('text/xml');
}
}//Only IE uses this, NOTE: Active X Object
else if (window.ActiveXObject)
{
try
{
http_request = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {}
}
}
//if still false, then XMLHTTP instance is not created
if (!http_request)
{
alert('Cannot create an XMLHTTP instance');
return false;
}
http_request.onreadystatechange = readyState;
http_request.open('GET', url, true);
http_request.send(null);
}
function readyState()
{
//Displaying all http_request.readyState
if(http_request.readyState == 1)
{
alert("1 (loading)");
}
if(http_request.readyState == 2)
{
alert("2 (loaded)");
}
if(http_request.readyState == 3)
{
alert("3 (interactive)");
}
if(http_request.readyState == 4)
{
if (http_request.status == 200)
{
var xmldoc = http_request.responseXML;
var root_node = xmldoc.getElementsByTagName('root').item(0);
alert(root_node.firstChild.data);
}
else
{
alert('Error with request');
}
}
}
</script>
<body>
<table width="200" border="0" align="center">
<tr><td>
<span style="text-decoration: underline" onClick="request('sample1.xml')">Request XML</span>
</td></tr>
</table>
</body>
</html>
try out that, if it doesn't work it's either your web server or your browser. it works for me with apache and firefox. now, to register and chuck it on the wiki!