Welcome Guest, Not a member yet? Register   Sign In
flushing content inside DIV
#1

[eluser]cellulit[/eluser]
hi guys;

i'm trying to achieve a fairly simple thing and either i coded something wrong or my approach is skewed. i'm calling a controller to be executed inside a div, via ajax function. the controller is supposed to throw a few messages, let's say every 5 seconds (in reality, after some actions are completed).

so my controller is:
Code:
function test()
{
    echo 'strat-';ob_flush();flush();
    sleep(5);
    echo 'sleep-';ob_flush();flush();
    sleep(5);
    echo 'stop';ob_flush();flush();    
}
everything is perfect if i run it as a separate page. start -> 5 sec -> sleep -> 5 sec -> stop
but if i call it inside a div, using ajax->link_to_remote; i can only see the final state, after 10 secs. nothing in the middle.

thank in advance for tips. i run out of ideas.
best;
cll
#2

[eluser]Phil Sturgeon[/eluser]
The AJAX request will wait for the HTML to be loaded then send it all back. You might consider creating separate requests and handling the timing with the JavaScript.
#3

[eluser]cellulit[/eluser]
thanks. i was afraid this will could be the answer Smile




Theme © iAndrew 2016 - Forum software by © MyBB