Newbie Ajax+Rails questions

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

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’

Exactly what I was looking for, thanks!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs