如何禁用使用ajax的表单提交?在表单提交之前,用户必须先点击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;
在此先感谢!
有必要在窗体提交上调用此操作?还有另外一种方法吗?让我知道 – 2013-05-04 04:54:33
是的,表单提交时需要此操作。 – 2013-05-04 05:23:23