Topic: progress bar for xajax function during the function execution

I have a PHP-xajax-function
PHP
function process($N=20)
{
    $objResponse=new xajaxResponse();
    for($i=0;$i<$N;$i++)
        sleep(1);//seconds
    return $objResponse;
}
In real life it generates a big PDF with $N pages and saves it to file.
How do I have to use xajax to make a DYNAMIC progress bar synchronously to this function? We start progress in 0 and finish in N-1, that corresponds to $N parameter.
How do I DYNAMICALLY assign $i from cycle to an html - <DIV> during the function execution ? What is the mechanism?

Re: progress bar for xajax function during the function execution

$objResponse->assign("div_progress","innerHTML",$i/$N);

3 (edited by edrobinson 2011-10-13 10:46:57 PM)

Re: progress bar for xajax function during the function execution

Well you can't assign during function execution but you can use the response obj's script() function to set a client side variable.

Once you return the response object, the transaction is over.

You could write out your pdf and return its path to a js function to display it in a single call to the server.

Perhaps this will help:

http://community.xajax-project.org/post/30599/#p30599

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.