0

I have a view with link_to method like this :

= link_to "Add Friend", friendships_path(:id => @user), :method => :post, :remote => true

As you can see I want to send a post request with link_to using ajax (remote: true).

This request go to the create method in friendships controller and it work fine (it create a relationship) but it render anything (firebug show me: 500 Internal Server Error).

views/friendships/create.js.erb

$("#my_selector").html("<%= escape_javascript(render('users/cancel_invitation')) %>")

views/users/cancel_invitation

= link_to "Cancel request", { :controller => "friendships", :action => "cancel", :id => @user }, data: { confirm: "Cancel friendship request?" }

I can't find the error.

4

1 回答 1

0

= link_to "Cancel request", { :controller => "friendships", :action => "cancel", :id => @user }, data: { confirm: "Cancel friendship request?" }, :remote => true

:remote => true位对于 ajaxy 的东西很重要。

于 2013-10-14T02:29:09.923 回答