Alright?
I do not know 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.
Run the .php file , but this file may take a while to display all your results, what I need is:
Run the .php file and after it processes the information from this file, rerun it (this time does not depend on it can take 10 to 50 seconds). So I'd like to do it this way, but I have no idea how.
Today I have a code that runs every X Seconds . But I would like it to repeat the same file when it finished executing the .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);