Hi,
I'm very new to xml, please bear with me. I have a javascript function that is called in a loop, the basics are (this is ie6):
Now, this thing is called from another js function that may call it 100 or more times in a loop, passing a different rownumber each time, and a url with the same pagename but different request variables following the url. The url is an asp page that writes to the database based on url request variables.
So the question is--let's say the processing for row 2 takes a long time. So row 3 calls this function and it does the req.open and req.send for row 3--does it affect in any way the already running global instance of req for row 2 (or any other, for that matter)?
Also, the same handler function will be called by each row for the req.open, and I'm wondering how can I know which rownumber/req instance the current instance of processReqChange is handling? I can't use a global row variable because as in the example above--the state changes may and will happen out-of-order, so depending on where I set a global row var, the current state-change may not be the state-change for that row's req.send. And I thought of doing a new object each time, but then I think that would definitely affect the current instance of req, since it's global.
This all is pretty basic and I imagine it's been answered before, so can anyone help out on this?
Thanks,
--Jim
I'm very new to xml, please bear with me. I have a javascript function that is called in a loop, the basics are (this is ie6):
Code:
function testx(url,rownum)
)//url is upddata.asp, rownum is the row of the loop that called this
// req is a global variable for the xml object
if (('' + req) = '') //only create on first loop
req = new ActiveXObject("Microsoft.XMLHTTP");
req.onreadystatechange = processReqChange;
req.open("POST", url, true
document.forms.frmmain.txtstatus.value = 'Processing ' + rownum
req.send();
}//end function testx
Now, this thing is called from another js function that may call it 100 or more times in a loop, passing a different rownumber each time, and a url with the same pagename but different request variables following the url. The url is an asp page that writes to the database based on url request variables.
So the question is--let's say the processing for row 2 takes a long time. So row 3 calls this function and it does the req.open and req.send for row 3--does it affect in any way the already running global instance of req for row 2 (or any other, for that matter)?
Also, the same handler function will be called by each row for the req.open, and I'm wondering how can I know which rownumber/req instance the current instance of processReqChange is handling? I can't use a global row variable because as in the example above--the state changes may and will happen out-of-order, so depending on where I set a global row var, the current state-change may not be the state-change for that row's req.send. And I thought of doing a new object each time, but then I think that would definitely affect the current instance of req, since it's global.
This all is pretty basic and I imagine it's been answered before, so can anyone help out on this?
Thanks,
--Jim