wondered whether anyone can help answer my question, I need to get the xml content from "data", as it is defined within a nested function within the yam_send function, I am trying to use return to get the variable back to the function 'GetBasicStatus' but it doesn't get all the way, can anyone shed any light on this. Sorry if this is an obvious solution, bit of a beginner I'm afraid.
function GetBasicStatus()
{
//do some stuff & define variable "command"
data = yam_send(command);
if (window.DOMParser)
{
parser=new DOMParser();
xmlDoc=parser.parseFromString(data,"text/xml");
}
else // Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.loadXML(data);
}
}
function yam_send(str)
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
var data=xmlhttp.responseText;
return data;
}
}
xmlhttp.open("GET","test.php?str",true);
xmlhttp.send();
}