What is the best approach for setting up sequential output for a PHP installer script? Say I have a page, and want to display incremental output within a DIV provided by a PHP script.
So page.html
might contain this:
<div id="output">
<!-- Script Output Here -->
</div>
And install.php might look like this (for testing purposes):
<?php
// Turn off Output Buffering
ob_end_flush();
// Begin Test Output (5 second intervals)
echo 'Testing incremental output...' . "\n";
sleep(5);
echo 'Step 1...' . "\n";
sleep(5);
echo 'Step 2...' . "\n";
sleep(5);
echo 'Complete!' . "\n";
I was thinking AJAX might be the best approach, but I'm not sure how to approach that. If I load "install.php" via JavaScript, I won't get everything back until the script finishes execution (correct?) - making this entire goal moot. I've seen this done before, but can't find a concrete example of how it was done.
Any help appreciated!