# RJS / AJAX question

**URL:** <https://www.ruby-forum.com/t/rjs-ajax-question/181967>\
**Category:** Rails\
**Created:** [January 20, 2010, 10:50pm UTC](https://www.ruby-forum.com/t/rjs-ajax-question/181967 "2010-01-20T22:50:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ea666f/32.png) [@bob](https://www.ruby-forum.com/u/bob)\
**Post date:** [January 20, 2010, 10:50pm UTC](https://www.ruby-forum.com/t/rjs-ajax-question/181967/1 "2010-01-20T22:50:44Z")

</div>

I have a custom class that is used to generate a report. The process  
of generating one line for this report takes anywhere from 1-3 seconds  
which can cause the report to take a while to finish running and to  
appear on the screen. I have an AJAX timer currently that tells the  
user that something is happening but I’m trying to improve this  
process. Because of the size of this report it can take up to 1.5  
minutes to completely run. My idea was to write something that could  
insert each row into the table as it is calculated via RJS / AJAX.  
Unfortunately rails seems to wait until all of the requests are built  
before sending any of the javascript updates to the browser rather  
than sending each update as it happens. Does anyone know of a way  
around this behavior so I can flush the updates to the browser?  
I’d like to do something like

render :update do |page|  
page.toggle 'results, ‘request’  
data.each do |row|  
page.insert\_html(:bottom, ‘table’, calc\_row\_data(row)  
flush\_results\_to\_browser  
end  
end

Is this possible?
