view:
<%= link_to_remote “Remove”, :url => { :controller => “auth_user”,
:action => :remove_req }, :id => “post.requirement_id” %>
controller:
def remove_req
redirect_to :action => :index
end
When I click on the link, it doesn’t redirect. What’s the problem?
Thanks
Justin To wrote:
view:
<%= link_to_remote “Remove”, :url => { :controller => “auth_user”,
:action => :remove_req }, :id => “post.requirement_id” %>
controller:
def remove_req
redirect_to :action => :index
end
When I click on the link, it doesn’t redirect. What’s the problem?
Thanks
An Ajax request cannot redirect the page… at least not this way. I
don’t think you want link_to_remote in this case. Try link_to. Note: you
want to be careful making links (HTTP GETs) do destructive things like
deleting data.
On Wed, Jul 30, 2008 at 12:45 PM, Justin To
[email protected] wrote:
end
When I click on the link, it doesn’t redirect. What’s the problem?
You probably want link_to not link_to_remote. link_to_remote does an
ajax call
link_to:
http://api.rubyonrails.com/classes/ActionView/Helpers/UrlHelper.html#M001601
link_to_remote:
http://api.rubyonrails.com/classes/ActionView/Helpers/PrototypeHelper.html#M001628
Hi
you can do like
def remove_req
render :update do |page|
page.redirect_to :action => :index
end
end