Load xml file from a project folder as asynchronous in chrome browser
Budget: $200 – $250 USD
I m trying to read a xml/ xsl file which is in a project folder to a variable for editing. Following code works with IE and chrome . But chrome gives an warning since this call is synchronous.
function loadXMLDoc (file name){
If (window.ActiveXObject){
xhttp = new ActiveXObject(“Msxml2.XMLHTTP”);
} else {
xhttp = new XMLHttpRequest();
}
xhttp.open(“GET”,filename, false); // false is synchronous
xhttp.send();
var xml = xhttp.responseXML;
return xml;
}
But if I make this asynchronize by changing this call.
xhttp.open(“GET”,filename, false);
To true
xhttp.open(“GET”,filename, true);
or call default.
xhttp.open(“GET”,filename);
It doesn’t work in chrome and gives error in the console.
original code works in IE but not working in chrome.
I want to fix this function or write a different method which can load an local xml / xsl asynchronous and get xml/xsl to a variable In chrome.
function loadXMLDoc (file name){
If (window.ActiveXObject){
xhttp = new ActiveXObject(“Msxml2.XMLHTTP”);
} else {
xhttp = new XMLHttpRequest();
}
xhttp.open(“GET”,filename, false); // false is synchronous
xhttp.send();
var xml = xhttp.responseXML;
return xml;
}
But if I make this asynchronize by changing this call.
xhttp.open(“GET”,filename, false);
To true
xhttp.open(“GET”,filename, true);
or call default.
xhttp.open(“GET”,filename);
It doesn’t work in chrome and gives error in the console.
original code works in IE but not working in chrome.
I want to fix this function or write a different method which can load an local xml / xsl asynchronous and get xml/xsl to a variable In chrome.