我有一个 rails 3.1 应用程序,我似乎无法通过 ajax 删除我的图像。我的代码示例是
def destroy
@photo = Photo.find(params[:id])
@photo.destroy
respond_to do |format|
format.html { redirect_to(user_photos_path(current_user)) }
format.js { render :nothing => true }
end
end
那么在我看来我有
<%= link_to '(delete)', profile_photo_path(photo.profile, photo), :method => :delete if me %>
在我的 application.js 我有
$('.delete_post').bind('ajax:success', function() {
$(this).closest('tr').fadeOut();
});
它对我不起作用。它执行动作但不会淡出