jquery popup 在 post 方法中提交表单

jquery popup submit the form in post method

这是我的表格

<form method="POST" action="adddriverprocess.php" enctype="multipart/form-data">
<...>
<...>
</form>

在提交中效果很好<input type="submit" value="Submit"/>

我正在尝试在其中添加 jquery 弹出窗口,按下表单应该执行 post 操作。

所以,我有这个 jquery 按钮

<a href="javascript:;" id="<?php echo url();?>/adddriverprocess.php" class="btnActivation"><button class="delete-btn btn-sm"><span class="icon"></span></button></a></td>

$('.btnActivation').click(fnActivation);
  function fnActivation() {
        var url =$(this).attr("id");
    $("#dialog-confirms").html("Are you sure you want to submit this form ?");
var buttonsConfig = [
    {
        text: "Yes",
        "class": "ok",
        click: function() {
        $(this).dialog('close');
        window.location.href=url;
        }
    },
    {
        text: "Cancel",
        "class": "cancel",
        click: function() {
        $(this).dialog('close');
        }
    }
];
    $("#dialog-confirms").dialog({
        resizable: false,
        modal: true,
        title: "Ma$na Taxi",
        height: 250,
        width: 400,
        buttons: buttonsConfig,
    });
}

弹出窗口很好,但是当我按下确定按钮时,它会将我带到 adddriverprocess 但是在 get 方法中,但我希望它在 post 方法中使用填充的数据在名字里。

我该怎么做?

在您的表单上添加一个 ID,并将您的 "Yes" 点击功能更改为 post 您的表单而不是位置。

改变这个:

click: function() {
    $(this).dialog('close');
    window.location.href=url;
}

为此:

click: function() {
    $('#MyForm').submit();
    $(this).dialog('close');
}

这是 jQuery submit() 文档: http://api.jquery.com/submit/