Part of the EllisLab Network
   
 
flushing content inside DIV
Posted: 06 October 2009 03:42 AM   [ Ignore ]  
Summer Student
Total Posts:  17
Joined  06-15-2009

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:

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

Profile
 
 
Posted: 06 October 2009 04:24 AM   [ Ignore ]   [ # 1 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  3150
Joined  06-11-2007

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.

 Signature 

————————
Blog | Twitter | GitHub | BitBucket
————————-
PyroCMS - open source modular CMS built with CodeIgniter
PancakeApp - Simple, hosted invoicing/w project management

Profile
 
 
Posted: 06 October 2009 05:37 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  17
Joined  06-15-2009

thanks. i was afraid this will could be the answer smile

Profile