Forum: Ruby on Rails Javascript/Prototype helper and redirect_to

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F677fa685a2cfe8aff31f161062db3d3?d=identicon&s=25 David (Guest)
on 2008-10-03 10:13
(Received via mailing list)
Is there a Javascript/Prototype helper with which you can use
redirect_to?  Ive been searching all around and can't seem to find any
information about this.  I need to use an ajax helper to send data
from a javascript function. I have been using  link_to_remote and
passing the data like so: :with => "'data='+newFunction()".  But by
using link_to_remote, I am unable to redirect to another action, which
is somewhat limiting.  Any input is appreciated.  Thanks.
1b507a552850441a516948d488962d2e?d=identicon&s=25 Sniper Abandon (mokkai)
on 2008-10-03 10:27
David wrote:
> Is there a Javascript/Prototype helper with which you can use
> redirect_to?  Ive been searching all around and can't seem to find any
> information about this.  I need to use an ajax helper to send data
> from a javascript function. I have been using  link_to_remote and
> passing the data like so: :with => "'data='+newFunction()".  But by
> using link_to_remote, I am unable to redirect to another action, which
> is somewhat limiting.  Any input is appreciated.  Thanks.

there is no redirect_to helper for Ajax  environment

you can use
    link_to_remote "Delete", :update => "div_id",
         :url  => {:controller=>'',:action=>''}, :method => :delete,
         :html => { :class  => "divs" }
or
link_to_remote "Delete", :update => "div_id", :url => { :action => "",
:id => @id }
F677fa685a2cfe8aff31f161062db3d3?d=identicon&s=25 David (Guest)
on 2008-10-03 10:41
(Received via mailing list)
So is there any way to pass the result of a javascript function to an
action in order to save information to the database and then use
redirect_to?

On Oct 3, 1:27 am, Pokkai Dokkai <rails-mailing-l...@andreas-s.net>
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-10-03 10:47
(Received via mailing list)
On Oct 3, 9:40 am, David <dly...@gmail.com> wrote:
> So is there any way to pass the result of a javascript function to an
> action in order to save information to the database and then use
> redirect_to?
>
The below information is wrong. When using rjs you can redirect (but
you need to use page.redirect_to, not redirect_to)

Fred
This topic is locked and can not be replied to.