What I'm trying to do is quite simple.
echo "doing a...."
Start progress bar
then exec("commandA")
stop progress bar
echo "doing b...."
Start progress bar
then exec("commandA")
stop progress bar
echo "doing c...."
Start progress bar
then exec("commandC")
stop progress bar
etc
The progress bar doesn't need to be accurate, more of a comfort to show something is happening.
I've read it can be done using jquery and php/ajax.. but I've no idea how. Anyone got a simple example I can try a work with ?
Thanks :)
The simplest way is to use twitter bootstrap:
http://twitter.github.com/bootstrap/components.html#progress
This is the server side part:
$command = isset($_GET['command']) ? $_GET['command'] : null;
if ($command == null) {
die("0");
}
echo (int) exec($command);
for ajax you can use jQuery ajax methods like $.get , $.post , $.ajax
$.get('exec.php', { command: 'commandA'}, function(response) {
if(response == 1) {
//and you can easily change the width of the progress bar with jQuery:
$(".bar").css('width', '40%');
} else {
alert("The execution got an error!");
}
}