52
rated 0 times
[
54]
[
2]
/ answers: 1 / hits: 17689
/ 12 Years ago, thu, august 23, 2012, 12:00:00
I am using the below code to read one xml file which is located locally. But its not displaying the object of xmldoc. My code is
function loadXMLDoc(XMLname)
{
var xmlDoc;
if (window.XMLHttpRequest)
{
xmlDoc=new window.XMLHttpRequest();
xmlDoc.open(GET,XMLname,false);
xmlDoc.send();
return xmlDoc.responseXML;
}
else if (ActiveXObject(Microsoft.XMLDOM))
{
xmlDoc=new ActiveXObject(Microsoft.XMLDOM);
xmlDoc.async=false;
xmlDoc.load(XMLname);
return xmlDoc;
}
alert(Error loading document!);
return null;
}
function f1()
{
var xmlDoc=loadXMLDoc(“test.xml”)
var M = xmlDoc.getElementsByTagName(“article”);
alert(M);
}
Its not displaying the alert if i call the function f1.Thanks in advance
More From » xml