Hello, I am trying to run a bunch of queries in a loop. How do I validate and wait for response for my previous objXMLHTTP.Send(httpXML) query before I proceed to next in loop?
I want to post a query, get the response for it and write in a file then proceed with the loop to post next query.
<Script Name=”JavaScript”>
var mynums=new Array(“36″,94″,………..,”39”); //made short
var objXMLHTTP = new ActiveXObject(“Microsoft.XMLHTTP”);
var httpURL = “
var httpMethod = “Post”
objXMLHTTP.Open(httpMethod, httpURL, false);
objXMLHTTP.SetRequestHeader(“Content-Type”, “application/x-www-form-urlencoded”);
var i = 0;
for(i = 0; i < 50; ++i){
var f = fso.OpenTextFile( “c:
var httpXML = mynums[i];
var xmlResponse = null;
objXMLHTTP.Send(httpXML);
xmlResponse = objXMLHTTP.ResponseText;
while (xmlResponse == null)
{
f.Write(“waiting”);
}
f.Write(xmlResponse);
</Script>
Thanks