V
vunet
I'd like to perform multiple XMLHTTP requests but one after the other,
ie. do next when previous one comes back ok.
Identifier to determine when to start the next one is a global
variable whose value is reset to none ("") with XMLHTTP handler
function. For example:
var someGlobal = "";
for(var i=0; i<10; i++){
if(someGlobal ==""){
someGlobal = i+"";
//do XMLHTTP request where handler function makes someGlobal = ""
at the end
}
}
Obviously, this will not work (or will work once) because someGlobal
will NOT be empty for the second loop since request takes some time to
finish and reset someGlobal.
Please advise as to how to implement it best. Thanks.
ie. do next when previous one comes back ok.
Identifier to determine when to start the next one is a global
variable whose value is reset to none ("") with XMLHTTP handler
function. For example:
var someGlobal = "";
for(var i=0; i<10; i++){
if(someGlobal ==""){
someGlobal = i+"";
//do XMLHTTP request where handler function makes someGlobal = ""
at the end
}
}
Obviously, this will not work (or will work once) because someGlobal
will NOT be empty for the second loop since request takes some time to
finish and reset someGlobal.
Please advise as to how to implement it best. Thanks.