Skip to content
Advertisement

AJAX progress bar of load script

I have a big problem to make a progress bar in AJAX. The whole page is in AJAX, inside one of the webpage is AJAX which loads a function to get some big rows from the database.

I tried to make progress bar in this script in a foreach loop a flush() method and by writing/reading to $_SESSION, but still nothing. I really tried everything I don`t know how to do this. Need only this to complete my project. Could someone help me with this?

It is anyway which script I want to load, how is the template for this progress bar to use it in GET or POST ajax, for any AJAX.

JavaScript

and here is a getresults.php

JavaScript

and a get progress function listen.php

JavaScript

Advertisement

Answer

Writing and reading session doesn’t work because the standard behavior of PHP is to lock the session file while your main code is being executed.

Try to create a file and update the its content with the percentage done during the execution of your function. Something like:

JavaScript

?>

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement