Laurie Harper wrote:
I still think it'd be easier to use the XmlHttpRequest's callback function to launch the next request in the queue rather than polling with a timer and requiring the callback to record state for the polling to query... Something like (pseudo-code):

  var q = [];
  function processQ() {
    function callback(req) {
      if (req failed) throw "XmlHttpRequest failed!";
      processQ();
    }

    if (q.length > 0) {
      var req = createReq(q.pop(), callback);
      ...
      req.send();
    }
  }

  ...

  q.push(req1);
  q.push(req2);
  processQ();

L.

I can't say I'm following this psuedo-code very well, but I do think your description above makes sense... Some UI event fires a function that (a) puts the call object in the queue and immediately fires the AJAX call *if* that's the only item in the queue... callback function removes the just completed item from the queue and fires the AJAX call for the next item, if any... rinse and repeat as required. That makes sense to me.

Frank


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to