Part of the EllisLab Network
   
 
flushing content inside DIV
Posted: 06 October 2009 02:42 AM   [ Ignore ]  
Summer Student
Total Posts:  14
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 03:24 AM   [ Ignore ]   [ # 1 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  2517
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
————————-
CodeIgniter 2: Everything you need to know
————————
PyroCMS - open source modular CMS built with CodeIgniter
CleverAndy - get money for un-used concept designs
————————
Libraries: Asset, Dwoo, Cache, cURL, CLI, REST, Template

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

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

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120375 Total Logged-in Users: 21
Total Topics: 126496 Total Anonymous Users: 4
Total Replies: 665217 Total Guests: 281
Total Posts: 791713    
Members ( View Memberlist )