我有以下内容:
<%= link_to my_path, method: :delete, confirm: 'Delete?', class: 'link-delete', 'data-message' => 'Are you sure?', 'data-severity' => 'danger', :remote => true do %>
<i class="icon-trash"></i>
<% end %>
我想要在弹出 Bootstrap 对话框进行确认时,挂接到Ajax调用中,以便我可以显示旋转图标或一些文本。
我知道如果我在link_to中不使用“:remote => true”,我可以使用不显眼的JavaScript来监听单击事件,就像下面这样:
jQuery ->
$('.link-delete').live 'click', (event) ->
$('.link-delete').html("Loading...") #THE MSG OR ANIMATION I WANT TO DISPLAY
$.get(this.href, null, null, 'script')
false
但不确定如何在使用“:remote => true”时将这两者结合起来
有什么建议吗?
感谢帮助