2013-10-14 3 views
0

내가 이런 LINK_TO 방법과보기가 작동하지 않습니다포스트 아약스 요청

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

당신은 내가 아약스 사용 LINK_TO와 POST 요청을 보낼 볼 수 있듯이 (원격 : true)를.

이 요청은 friendship 컨트롤러의 create 메소드로 이동하고 괜찮 으면 (관계를 생성하지만) 렌더링합니다 (방화 광 쇼 : 500 Internal Server Error). 내가 오류를 찾을 수 없습니다

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

보기/우정/create.js.erb

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

보기/사용자/cancel_invitation.

답변

0

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

:remote => true 비트 ajaxy 물건 중요하다.