Defining a customized dialog to achieve this functionality may be more appropriate.
function showPrompt(title, href, fn){
var dlg = $('<div></div>').appendTo('body').dialog({
width: 300,
height: 150,
title: title,
href: href,
modal: true,
buttons:[{
text: 'Ok',
handler: function(){
var d = $(this).closest('div.panel').find('div.panel-body');
var json = d.find('form').serialize();
fn(json);
d.dialog('destroy');
}
},{
text: 'Cancel',
handler: function(){
var d = $(this).closest('div.panel').find('div.panel-body');
d.dialog('destroy');
}
}],
onClose: function(){
$(this).dialog('destroy');
}
}).dialog('dialog').find('.dialog-button').css('text-align','center')
}
Usage example:
showPrompt('Prompt', '_form.html', function(json){
console.log(json);
});