Short and sweet: Looking for a way to call PHP file and display the progress using jQuery and/or Ajax. PHP file upgrade.php?step=1 is called and then the output returned is appended to #upgradestatus. After that is completed upgrade.php?step=2 is called and that output is appended until the specified number of steps is completed.
Explanation: I'm attempting to create a plugin for software that runs in PHP. This plugin will call each step through the PHP file to upgrade each file, etc. I want to be able to display the progress on the page without reloading it to show the user what has been done and where the process is at.
Using my PHP thought process I wanted to create something similar to this:
for (var s=0; s<2; s++){
$('#upgraderesult').load('upgrade.php', 'step=' + s, function() {
$('#upgradestatus').append('Upgrade Step ' + s + ' Completed');
});
}
I attempted to use .ajax() as well and with both of these methods I soon learned that being Async this is going to be a little more tricky to figure out.
My thought behind this was to create a FOR loop that would loop for the amount of steps there are. That for loop would then generate the necessary jQuery/Ajax code that will append to the existing div #upgradestatus with the status message. I wanted it to append the result loaded in #upgraderesult but to keep it simple i just added the "Upgrade Step X Complete".
So now i'm stuck and thinking I may just need to use PHP to generate the correct jQuery/Ajax code but I wanted to check and see if anybody else has any opinions or suggestions on how this could be done a different way or even if i'm thinking about this complete wrong.
All I want is to be able to call the PHP file based off the step in the process and then display the progress to the user in the browser...which has turned out to be a lot more difficult than i thought.
Thanks for any input or recommendations/suggestions, I greatly appreciate it!