我有一个php页面,需要一个模态确认。
当点击对话框中的"请确认"时,我希望页面帖子继续。我究竟怎样才能做到这一点呢?
下面是我的js代码: $(document).ready(function() {
var $dialog = $('<div></div>')
.dialog({
autoOpen: false,
title: 'Are you sure?',
modal: true,
closeOnEscape: true,
buttons: {
"Please confirm": function() {
// want to continue the post that was interrupted
// by this dialog
$("#account_mgr").submit();
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
window.location = "/account_mgr#MySubscription";
}
}
});
// $('#btnSubscription').click(function() {
$('#btnSubscription').live('click', function() {
$dialog.dialog('open');
return false;
});
});
假设按钮发布表单,那么只提交表单;
buttons: {
"Please confirm": function() {
$( this ).dialog( "close" );
$('#btnSubscription').parents('form').submit();
},
Cancel: function() {
$( this ).dialog( "close" );
window.location = "/account_mgr#MySubscription";
}
}