繁体   English   中英

如何使用甜蜜警报发布到控制器动作结果方法? MVC5 C#

[英]How to post to an controller action result method using sweet alert? 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是form,那么类似下面的内容可能会让您入门:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM