如何禁用使用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