【发布时间】:2015-06-10 03:42:42
【问题描述】:
如何禁用使用 ajax 的表单提交?在提交表单之前,用户必须先点击 ajax 对话框中的按钮。
//on form submit
//I'm using input type submit and not button (as much as possible, I don't want to change that)
$.ajax({
type: "POST",
url: "<?=url::base(TRUE)?>prompt",
data: $('#formname').serialize(),
async: false,
success: function(response){
$("#dialogpromt").html(response);
$("#dialogpromt").dialog({
autoOpen: true,
height: 'auto',
width: '100',
resizable: 'false',
dialogClass: 'dFixed'
});
//onlcick event would change a hidden field to '1'
//works fine
},
});
//Is there a way I can ensure that the dialog above is closed first before the below lines will execute?
if(document.getElementById('submitInd').value == "0")
return false;
else
return true;
提前致谢!
【问题讨论】:
-
有必要在表单提交时调用这个动作吗?还有另一种方法吗?告诉我
-
是的,表单提交时需要此操作。
标签: javascript jquery html ajax forms