I'm working on my first Laravel app, that at some stage loops through a large amount of data and I temporary added a primitive progress bar so I can have an idea how long it will take to finish...
It is working as it should on Win 8.1 XAMPP, but when I move it to Windows server 2016 (IIS + PHP 7.3.1 + MySQL 5.5) , the page just keeps loading, then suddenly it's 100%... or it the whole process fails, but that's an other problem.
Here is my primitive code:
-
create the progress bar html
echo'<div class="w3-container w3-display-middle" style="width:75%"> <p id="progress2text" style="visibility: hidden;">Pre-analyzing</p> <div class="w3-border" id="progress2" style="height:24px; visibility: hidden;"></div><br> <p>Analyzing - Do not close the page! You will be redirected when it is done...</p> <div class="w3-border" id="progress3" style="height:24px;"></div>';
-
making the progress bar visible
echo '<script language="javascript"> document.getElementById("progress2text").style.visibility = "visible"; document.getElementById("progress2").style.visibility = "visible"; </script>'; -
updating process bar at the beginning of every loop
while(){ //caluclating $percent here echo ' <script language="javascript"> document.getElementById("progress2").innerHTML="<div class=\"w3-green w3-center\" style=\"height:24px;width:'.$percent.'%\">'.$percent.'%</div>"; </script>'; }
Thank you.