form_remote_tag and redirect_to?

I'm using a form_remote_tag for a small form for which I want to show
any errors without the page having to reload. This part works fine,
but how do I use redirect_to with it? Once the form is submitted and
saved successfully (with no errors), I want to redirect to another
controller, but what's happening is the page isn't reloading - the
output from that other controller is just replacing the form in that
ajax element. I couldn't find anything about it in the API docs for

You have to use js to change the location.href. Put something like
this in your controller:

render(:update) {|page| page.redirect_to :action => 'foo' }



I am using that piece of code and the page redirects fine, but just
before the redirect I see a chunk of javascript (or some kind of code)
appear on the page (try/catch block of some sort). Is there any way to
hide this code?