这是我的表格
<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 按钮时,它会将我带到 adddriver进程,但在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/