Ok, looking at your code i think you have combined logic that is supposed to be separated.
1. Use ajax to get the file contents/xml from server-side using a ReadFromXmlFile.aspx page. This page will read from the xml file and return this to your client.
function GetXmlData()
{
var xmlhttp;
if ( window.XMLHttpRequest )
{
xmlhttp=new XMLHttpRequest( );
}
else
{
xmlhttp=new ActiveXObject( "Microsoft.XMLHTTP" );
}
xmlhttp.onreadystatechange=function( )
{
if ( xmlhttp.readyState==4 && xmlhttp.status==200 )
{
var xDoc = LoadXml( xmlhttp.responseText );
}
}
xmlhttp.open( "GET","ReadFromXmlFile.aspx",true );
xmlhttp.send( );
}
}
function LoadXml(xmlData)
{
if (window.DOMParser)
{
parser=new DOMParser();
xmlDoc=parser.parseFromString(xmlData,"text/xml");
}
else
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.loadXML(xmlData);
}
return xmlDoc;
}