As always, excuse my 'Tarzan' english, please :P
The issue is: I have to call a webService with time intervals to ensure that a list of contacts is uploaded completely.
The procedure is:
1.-Click on a button to send the CSV file.
2.-A div with a upload animation must bee seen WHILE UPLOADING THE CSV to the database.
3.-When the websService ends entering the data, the div with the unload animation must disappear.
I've created a JS function that ' I Think' is ok, as shown:
function loadWS(idArchive){
    $('#loaderX').css('display', 'block');            //Here starts with the animation
    var interrupt=setInterval(function(){             //Start asking the WS
    $.ajax({
        data:{
            'idArchive': idArchive,
        },
        url:'/NewsLetters.checkFinal',                //WebService call: the webservice checks 
        type:'post',                                  //if register entry is complete.
        success:function(res){
            var r=eval(res);
            if(r==1){                                 //IF Response ok? we've finished the task
                clearInterval(interrupt);
                load_sec(link,106);                   //This reloads the section via AJAX
                $('#loaderX').css('display', 'none'); //Here stops the animation
            }
            if (r==0) {
            }
        }
    });
},1000);
}
Am I doing something wrong? Is it correct to call the WS in the setInterval proc?
Thanks to all in advance!
 
     
    