0
我在用戶配置文件頁面中定義了一個link_to以刪除該帳戶。刪除確認對話框不顯示
= link_to "Delete My Account", user_path(@user), :method=>:delete, :confirm => "Are you sure to delete your account?"
jQuery代碼是Java腳本/ application.js中,如下所示:
var delete_path = $(this).attr('href');
$(".confirm").confirm({
text: "Are you sure you want to delete your account?",
title: "Confirmation required",
confirm: function(button) {
alert("You have confirm!")
window.location.href = delete_path;
},
cancel: function(button) {
$(this).dialog("close");
},
confirmButton: "Yes I want to delete my account",
cancelButton: "No I want to go back",
post: true,
confirmButtonClass: "btn-danger",
cancelButtonClass: "btn-default",
dialogClass: "modal-dialog modal-lg" // Bootstrap classes for large modal});
實際上按鈕功能阱和帳戶已成功刪除。但確認對話框沒有顯示出來。我是Jquery的新手。不知道是否遺漏了一些組件。