这是我的表格
<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
方法中使用填充的数据名。
我该怎么做?
答案 0 :(得分:1)
在表单上添加ID并更改“是”点击功能以发布表单而不是位置。
改变这个:
click: function() {
$(this).dialog('close');
window.location.href=url;
}
对此:
click: function() {
$('#MyForm').submit();
$(this).dialog('close');
}
这是jQuery submit()文档: http://api.jquery.com/submit/