如何张贴到一个控制器的行动结果方法使用甜警报?mvc5 c#



我在我的web应用程序中使用甜蜜提醒。我遇到过类似问题的帖子,他们从来没有相应地回答过。我想知道我将如何去张贴到一个动作结果方法一旦用户确认。支持代码如下。请帮助。

swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: " warning ",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
cancelButtonText: " No, cancel plx!",
closeOnConfirm: false,
closeOnCancel: false
}, function(isConfirm) {
if (isConfirm) {
    swal("Deleted!", "Your imaginary file has been deleted.", "success");
} else {
    swal("Cancelled", "Your imaginary file is safe: ) ", " error ");
}
});

我不确定你的形式在哪里,但假设它的id是形式,那么下面的东西可能会让你开始:

swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: " warning ",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
cancelButtonText: " No, cancel plx!",
closeOnConfirm: false,
closeOnCancel: false
}, function(isConfirm) {
if (isConfirm) {
// once confirm, post your form
    $("#form").submit();
} else {
    swal("Cancelled", "Your imaginary file is safe: ) ", " error ");
}
});

最新更新