/    Sign up×
Community /Pin to ProfileBookmark

Wait for and validate xml send query response

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 = “http://www.myserver.com/test.asp?myrequest
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:my_output.txt”, 8 );
var httpXML = mynums[i];

var xmlResponse = null;
objXMLHTTP.Send(httpXML);
xmlResponse = objXMLHTTP.ResponseText;
while (xmlResponse == null)
{
f.Write(“waiting”);
}

f.Write(xmlResponse);

</Script>

Thanks

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @marked9 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...