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