jQuery Modal Dialog - I must be missing a simple thing
I have a php page that needs a modal confirmation.
When clicking "Please confirm" on the dialog, I want the page post to continue. How in the world can I accomplish this?
Here is my js code so far:
$(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
// b开发者_如何学Pythony 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;
});
});
Assuming the button otherwise posts a form, then just submit the form;
buttons: {
"Please confirm": function() {
$( this ).dialog( "close" );
$('#btnSubscription').parents('form').submit();
},
Cancel: function() {
$( this ).dialog( "close" );
window.location = "/account_mgr#MySubscription";
}
}
精彩评论