Run File in PHP - Jquery or Javascript

Asked

Viewed 428 times

-2

all right?

I have no knowledge in Jquery or Javascript, but I know PHP x Mysql well.

I would like to know, how to do the following procedure, I hope I can explain.

Execute the php file., but this file may take some time to display all your results, what I need is:

Execute the php file. and after it processes the information of this file, run it again ( that time, does not depend can take 10 to 50 seconds ). So I would like to do this way, but I have no idea how to do.

Today I have a code that rotates every X Seconds. But I would like him to repeat the same file, when he finishes the execution of php file.

Please help me if possible...

    <script type="text/javascript">

var track_click = 0; 
var total_pages = <?php echo $total_pages; ?>;

var funcaoTimer = setInterval(function(){
    $('.load_mensagem').hide();  
    $('.animation_image').show();                

    var resultado = ( track_click / total_pages ) * 100;

    var new_num = resultado.toFixed(1);

    var new_num = "Exportando: " + new_num + "%";               

    document.title = new_num;

    if (track_click > total_pages -1 ) {
        $('.animation_image').hide();
        clearInterval(funcaoTimer);
        $('.load_more').show();
        $(".load_more").attr("disabled", "disabled");
        $('.load_more').text("EXPORTA\u00c7\u00c3O REALIZADA COM SUCESSO!");  
        $('.load_mensagem').show();     
        $('.load_mensagem').text("REALIZAR DOWNLOAD");  
        $(".load_mensagem").attr("enable", "enable");

    } else if (track_click <= total_pages){

        $.post('arquivo.php', {'page': track_click}, function(data) {
            $("#results").append(data);
            track_click++;
        }).fail(function(xhr, ajaxOptions, thrownError) {
            alert(thrownError);
            $(".load_more").show();
            $('.load_more').text("ACONTECEU UM ERRO, DURANTE O PROCESSO!");  
            $('.animation_image').hide();
            $('.load_mensagem').hide();
        });

    }

}, 1000);

1 answer

-2

Do you agree that the file will run in the sequence it was written ? Then just put a redirect at the end of the file to itself. When it is at the end of processing, redirect.

 <?php    
header('location: arquivo.php');    
?>
  • Unfortunately, I have to display loading in percentage for the customer to see the evolution, see the code... Customer Request...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.