# Newbie Ajax+Rails questions

**URL:** <https://www.ruby-forum.com/t/newbie-ajax-rails-questions/116302>\
**Category:** Rails\
**Created:** [October 4, 2007, 11:06am UTC](https://www.ruby-forum.com/t/newbie-ajax-rails-questions/116302 "2007-10-04T11:06:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 4, 2007, 11:06am UTC](https://www.ruby-forum.com/t/newbie-ajax-rails-questions/116302/1 "2007-10-04T11:06:29Z")

</div>

Hi everybody!

I’m working on a small Rails app which lets the user enter a small  
script & submit it.  
This app then launches a third party executable to parse that script,  
and finally shows the result.

The execution time from the third party app can be somewhat long, and  
I’d like to show a spinner meanwhile.

I used 3 different actions (index / execute / result) in the same  
controller.  
Thanks to a form\_remote\_tag, ‘execute’ action is called from index,  
while displaying a spinner.gif.  
But I’d like my app to redirect to ‘result’ action when ‘execute’ is  
finished.  
Is that possible?

I tried with

def execute  
…  
…  
redirect\_to :action=\>‘result’  
end

but my browser stays on index page, and doesn’t display anything from  
‘result’ action.

I also tried to use render :update inside ‘result’ action, in order to  
update index page. It works, but a browser refresh with F5 destroys  
results and show an empty index page.

Is something wrong in my structure? Is it possible to show a spinner  
without using AJAX?

Thanks a lot,

Eric

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 4, 2007, 11:33am UTC](https://www.ruby-forum.com/t/newbie-ajax-rails-questions/116302/2 "2007-10-04T11:33:11Z")

</div>

def execute  
…  
…  
render :update do |page|  
page.redirect\_to :controller =\> ‘blahblah’, :action=\>‘result’  
end  
end

or in execute.rjsj

page.redirect\_to :controller =\> ‘blahblah’, :action=\>‘result’

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 4, 2007, 12:51pm UTC](https://www.ruby-forum.com/t/newbie-ajax-rails-questions/116302/3 "2007-10-04T12:51:19Z")

</div>

Exactly what I was looking for, thanks!
