I would like to retrieve a value in a xml file and use this value in another function.
I use:
function xmlparser() {
var xmlhttp, myvar;
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "http://www.domain.net/xmlfile.xml", true);
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
myvar = xmlhttp.responseXML.documentElement.getElementsByTagName("date")[0].textContent;
}
}
xmlhttp.send();
}
How can I use myvar in another function ?
Like
function test() {
alert(myvar);
}
Thanks