Javascript/Prototype helper and redirect_to


#1

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.


#2

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 }


#3

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 D. removed_email_address@domain.invalid


#4

On Oct 3, 9:40 am, David removed_email_address@domain.invalid 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