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

本文关键字:方法 结果 mvc5 何张贴 控制器 一个 | 更新日期: 2023-09-27 18:05:40

我在我的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 ");
}
});

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

我不确定你的形式在哪里,但假设它的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 ");
}
});