1
我在我看來具有coffescript實現4個按鈕coffescript按鈕,這裏是視圖確認彈出與
%button#warn.button{:type => "submit"}
Warn
%button#ban.button{:type => "submit"}
Ban
%button#delete.button{:type => "submit"} ,
Delete
%button#hide.button{:type => "submit"}
Hide
在js.coffee文件,這是我寫的
$(document).ready ->
$("#warn").click ->
target = "check_warned"
$("#needs_form").attr "action", target
$("#needs_form").submit()
$("#ban").click ->
target = "ban "
$("#needs_form").attr "action", target
$("#needs_form").submit()
$("#delete").click ->
target = " delete "
$("#needs_form").attr "action", target
$("#needs_form").submit()
$("#hide").click ->
target = " hide "
$("#needs_form").attr "action", target
$("#needs_form").submit()
現在我需要添加一個確認彈出「你確定要刪除這些帖子嗎?」當我點擊刪除按鈕..有關如何將其嵌入到此代碼中的任何幫助?
非常感謝你=) –
對不起我有一個關於同一部分anothe rquestion,如果我想按刪除按鈕後,使用Ajax,這怎麼能是可行的?我的理解是,我必須用戶form_remote_tag而不是form_tag,但有一個錯誤:未定義的方法'form_remote_tag'爲#<#:0x007fe34d3d4ba8> –