I don't know how to make multiple requests work.  I do know that I
would change your design.  If the return of your second post,
'website/etatdlall.php', contains info on if its complete, you can
kick off the "finished, download now" function from here and keep
things serial.  Keep it simple is the best approach.

Jon

On Nov 5, 2:53 pm, Phenix <[email protected]> wrote:
> Hello,
>
> I'm using version 1.2.4 of Mootools on a php script which creates a
> zip archive of several files. The process can takes time so i want to
> check every 5 seconds what is doing the archiver.
>
> First of all, i launch a first request  which calls the zip archiver
> and start adding all the files :
>
> ***
> var mainReq =new Request({url: 'website/dlall.php?token='+token,
>          method: 'post',
>          onComplete:function(data){
>                             ok = true;
>                             timedReq.stopTimer();
>                             $('etat-dlall').innerHTML = "4/4 Files
> added, you can download it";
>                      }
>          }).send(data);
> ***
>
> This request can takes time so i launch timed requests to get each 5
> seconds the state of the archive (which is updated by the first script
> (dlall.php)) :
>
> ***
> var timedReq = new Request({
>             method: 'post',
>             url:  'website/etatdlall.php',
>             initialDelay: 5000,
>             delay: 5000,
>             limit: 15000,
>             onComplete:testdlall
>         }).startTimer({
>             token: token
>         });
>
> function testdlall(txt) {
>         if(!ok) {
>             var data = JSON.decode(txt);
>             if(data.etat == "1" || data.etat == "2" || data.etat ==
> "3") {
>                 $('etat-dlall').innerHTML = data.etat + "/4 : " +
> data.texte + "  loading...";
>             }
>             else if(data.etat == "4") {
>                 $('etat-dlall').innerHTML =data.etat + "/4 : "
> +data.texte;
>                 timedReq.stopTimer();
>             }
>             else {
>                 $('etat-dlall').innerHTML = txt;
>                 timedReq.stopTimer();
>             }
>         }
>     }
> ***
>
> I thought that it was possible to manage multiple requests in the same
> time but it doesn't work in this case. The first request is fired,
> then the second, but the second waits the first to finish to return
> data... So i can't have an updated state of the archive.
>
> Do you have any idea why the second script can't work in parallel with
> the first?
>
> Thanks a lot!

Reply via email to