Ok a few things here:
1) Where is request defined?  You're in a loop, you are re-using a
single request object.  So second trip through loop, and yes the
request may still be open.
2) Be aware - you are creating a closure 'request.onreadystatechange =
function(){...' - This closure will execute when the request is ready,
not when the execution point reaches this code.  So in your loop - you
may generate several requests (depending on how many connections your
browser allows) before you receive back a single response.

On Jun 24, 3:03 pm, vvn <[email protected]> wrote:
> well when the app is offline some values are stored on a local table
> tActions, once that it gets online the following function is executed
> to retrieve all values from that table and update the server's DB,
> sending the retrieved values to the script: update_actions.asp? .....
> but, just the firstone is executed for the next one I retrieve the
> "request is already open" and stops there.
>
> function actions_retrieve()
> {
>         open_tActions();//opens the required table
>         var update_string = "";
>         var rs = db.execute('select * from tActions');
>
>         while (rs.isValidRow())
>         {
>                 update_string = "update_action.asp?tActionsID="+[rs.field(0)]
> +"&CompanyID="+[rs.field(1)]+"&CdEmp="+[rs.field(2)]+"&PsEmp="+
> [rs.field(3)]+"&ActionTypeID="+[rs.field(4)]+"&Hour="+[rs.field(5)]
> +"&Minute="+[rs.field(6)]+"&Second="+[rs.field(7)]+"&Month="+[rs.field
> (8)]+"&Day="+[rs.field(9)]+"&Year="+[rs.field(10)];
>
>                 request.open('GET',update_string);
>
>                 request.onreadystatechange = function()
>                 {
>                   if (request.readyState == 4) {
>                                 if (request.responseText == "OK")
>                                 {
>                                         db.execute('delete from tActions 
> where tActionsID =?', [rs.field
> (0)]);
>                                 }
>                   }
>                 };
>                 request.send();
>                 rs.next();
>          }
>         rs.close();
>
>
>
> }

Reply via email to