Escaping from Ajax in 1.2.1

Way back in the old days (Rails 1.1.6), you could go from an ajax form
back to the real world by doing something like this:

render :update do |page|
page.redirect_to(:controller => ‘foo’, :action => ‘bar’)
end

I just upgraded my in-progress app to 1.2.1, and this seems to be broken
now. I get the dreaded old “redirection script showing up in the
browser” thing happening, which is what this rjs snippet was supposed to
fix (and used to do).

Is this no longer the proper way to redirect out of Ajax land? Or did I
just mess up in some other way and weakly blame this on 1.2.1?

thanks,
jp

Jeff P. wrote:

Way back in the old days (Rails 1.1.6), you could go from an ajax form
back to the real world by doing something like this:

render :update do |page|
page.redirect_to(:controller => ‘foo’, :action => ‘bar’)
end

I just upgraded my in-progress app to 1.2.1, and this seems to be broken
now. I get the dreaded old “redirection script showing up in the
browser” thing happening, which is what this rjs snippet was supposed to
fix (and used to do).

Is this no longer the proper way to redirect out of Ajax land? Or did I
just mess up in some other way and weakly blame this on 1.2.1?

thanks,
jp

Make sure that your ajax call doesn’t have an :update key in it. If it
does, your javascript will be rendered as text since it’s not wrapped in
a tag.

If this is the problem than rails 1.2 is not to blame since I ran into
that in 1.1.6