繁体   English   中英

jQuery弹出窗口以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,
    });
}

弹出窗口很好,但是当我按OK按钮时,它将带我进入adddriverprocess,但在get方法中,但我希望它在post方法中使用名称中填写的数据来执行。

我怎样才能做到这一点 ?

在表单上放置一个ID,然后更改“是”单击功能以发布表单而不是位置。

更改此:

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

对此:

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

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

暂无
暂无

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

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