Newbie Ajax+Rails questions

Eric DUMINIL
Thu, 04 Oct 2007 09:05:45 -0000

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