Javascript 引导盒确认未在ASP.NET MVC 5中提交表单

Javascript 引导盒确认未在ASP.NET MVC 5中提交表单,javascript,asp.net-mvc,bootbox,Javascript,Asp.net Mvc,Bootbox,我正在尝试在ASP.NET MVC 5中使用引导盒确认 我有以下JavaScript代码: $(document).on("click", "#close", function (e) { e.preventDefault(); var $this = $(this); bootbox.confirm("Are you sure you want to close this Service Request? This ope

我正在尝试在ASP.NET MVC 5中使用引导盒确认

我有以下JavaScript代码:

$(document).on("click", "#close", function (e) {
            e.preventDefault();
            var $this = $(this);
            bootbox.confirm("Are you sure you want to close this Service Request? This operation cannot be reversed.", function (result) {
                    if (result) {
                        $this.submit();
                    } else {
                        console.log("user declined");
                    }
});
使用此按钮:


但是,当我按下启动盒上的ok按钮时,表单不会提交。如何解决此问题?

在该范围内,
$this
是按钮,而不是表单。您不能提交按钮。你可以做:

$this.closest('form').submit();

“form”应该是我表格的名称吗?我不知道如何找到表单名称好的,我已经将表单命名为“frm”并更改了代码,但仍然无法使用任何人的帮助??不,jQuery使用CSS样式选择器。也就是说,获取与此元素最接近的表单元素父元素。关于提交表单所需的内容,有什么建议吗?