J
jfizer
I have a web app that uses a form with its fields populated from XML
using Microsoft.XMLDOM. The problem is that Microsoft.XMLDOM functions
seem to run on their own thread, so I dont know when the fields are
done populating.
Can anyone think of a way for me to check when the following function
finishes?
function importXML(xmlQuery,xmlSrc,xmlTarget)
{
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = function () {
if (xmlDoc.readyState == 4)
parseXML(xmlQuery,xmlSrc,xmlTarget,xmlDoc)
};
xmlDoc.load("http://home1/sandbox/XMLResponder.nsf/XMLResponder?openagent&frm="+
xmlSrc +"&z=.xml");
return true;
}
function parseXML(xmlQuery,xmlSrc,xmlTarget,xmlDoc)
{
var x = xmlDoc.getElementsByTagName('field');
var sValue;
var sText;
for (i=0;i<x.length;i++)
{
var row = document.createElement('TR');
for (j=0;j<x.childNodes.length;j++)
{
if (x.childNodes[j].nodeType != 1)
continue;
sValue =
x.childNodes[j].firstChild.nodeValue;
j++;
sText =
x.childNodes[j].firstChild.nodeValue
addOption(xmlTarget,sText,sValue);
}
}
}
using Microsoft.XMLDOM. The problem is that Microsoft.XMLDOM functions
seem to run on their own thread, so I dont know when the fields are
done populating.
Can anyone think of a way for me to check when the following function
finishes?
function importXML(xmlQuery,xmlSrc,xmlTarget)
{
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = function () {
if (xmlDoc.readyState == 4)
parseXML(xmlQuery,xmlSrc,xmlTarget,xmlDoc)
};
xmlDoc.load("http://home1/sandbox/XMLResponder.nsf/XMLResponder?openagent&frm="+
xmlSrc +"&z=.xml");
return true;
}
function parseXML(xmlQuery,xmlSrc,xmlTarget,xmlDoc)
{
var x = xmlDoc.getElementsByTagName('field');
var sValue;
var sText;
for (i=0;i<x.length;i++)
{
var row = document.createElement('TR');
for (j=0;j<x.childNodes.length;j++)
{
if (x.childNodes[j].nodeType != 1)
continue;
sValue =
x.childNodes[j].firstChild.nodeValue;
j++;
sText =
x.childNodes[j].firstChild.nodeValue
addOption(xmlTarget,sText,sValue);
}
}
}