JimiRaveon
IS-IT--Management
I am trying to get this script to loop and keep getting error message "Object Expected" Anyone have any ideas?
Here's the code:
<html>
<head>
<script language="javascript">
function getData()
{
xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = processData;
xmlHttp.open("GET","xmltest.xml",true);
xmlHttp.send(null);
xmlDoc = xmlHttp.responseXML;
}
function processData()
{
document.write(xmlDoc.getElementsByTagName("firstname")[0].childNodes[0].nodeValue);
setTimeout(getData(),3000);
}
</script>
</head>
<body onLoad="getData()">
</body>
</html>
Here's the code:
<html>
<head>
<script language="javascript">
function getData()
{
xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = processData;
xmlHttp.open("GET","xmltest.xml",true);
xmlHttp.send(null);
xmlDoc = xmlHttp.responseXML;
}
function processData()
{
document.write(xmlDoc.getElementsByTagName("firstname")[0].childNodes[0].nodeValue);
setTimeout(getData(),3000);
}
</script>
</head>
<body onLoad="getData()">
</body>
</html>