Popup dialog

Popup dialog

pbethellpbethell Posts: 3Questions: 0Answers: 0
edited February 2012 in Bug reports
It took me forever to get a pop up dialog working, this is what I have, anyone have any suggestions on what can make it cleaner?
(I had to use an image, it wouldn't work with a link)
display page:
[code]








function dialogForms(href,title) {
var a = $(this);
$.get(href,function(resp){
var dialog = $('').attr('id','formDialog').html(resp);
$('body').append(dialog);
dialog.find(':submit').hide();
dialog.dialog({
title: title ? title : '',
modal: true,
buttons: {
'Save': function() {$( this ).dialog( "close" ); submitFormWithAjax($(this).find('form'));},
'Cancel': function() {$(this).dialog('close');}
},
close: function() {$(this).remove();},
width: '750'
});
}, 'html');

return false;
}
function submitFormWithAjax(form) {
form = $(form);
$.ajax({
url: form.attr('action'),
data: form.serialize(),
type: (form.attr('method')),
success: function(data)
{

var $dialog = $('')
.html(data)
.dialog({
modal: true,
title: 'Confirmation',
buttons: {
Ok: function() {
$( this ).dialog( "close" );
location.href='voters_list.php';
}
}
});
}

});
return false;
}

$(document).ready(function() {
oTable = $('#example').dataTable( {
"bJQueryUI": true,
"bProcessing": true,
"bServerSide": true,
"bStateSave": true,

"aaSorting": [[1,'asc'], [2,'asc']],
"sPaginationType": "full_numbers",
"sDom": '<"H"lfr>t<"F"ip>T',
"sAjaxSource": "voters_datatable_list_controller.php",
"fnInitComplete": function() {
$('#example tbody tr').each(function(){
$(this).find('td:eq(5)').attr('nowrap', 'nowrap');
});

}

} );




} );



[/code]

server side adds:

[code]
if ( $aColumns[$i] == " " )
{
/* Special output formatting for 'version' column */
$row[] = "";
}
else if ( $aColumns[$i] != ' ' )
{
/* General output */
$row[] = $aRow[ $aColumns[$i] ];
}
[/code]
This discussion has been closed.