function readxml(filename) {
xmlHttp = new window.xmlHttpRequest();
xmlHttp.open("GET", filename, false)
xmlHttp.send(null)
xmlDoc = xmlHttp.responseXML.documentElement
}
function loadXMLDoc(dname)
{
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
xmlDoc=document.implementation.createDocument("","",null);
}
catch(e) {alert(e.message)}
}
try
{
xmlDoc.async=false;
xmlDoc.load(dname);
return(xmlDoc);
}
catch(e) {alert(e.message)}
return(null);
}
How do I modify it here? Readxml is for Chrome, and the second method is for Internet Explo... loadXMLDoc works, but readxml doesn't work,,,
javascript xml
Well, I'm not sure because I don't see the error content or the use inside the Chrome developer tool However, when I checked the example listed in the stack overflow among similar examples, I think it would be a similar problem. They gave us the current example code.
function readxml(filename) {
xmlHttp = new window.xmlHttpRequest();
xmlHttp.open("GET", filename, false)
xmlHttp.send(null)
xmlDoc = xmlHttp.responseXML.documentElement
}
Please add this part
<?xml version='1.0'?>
© 2024 OneMinuteCode. All rights reserved.