如何使用 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;
提前致谢!