Background:
A table with rows is created dynamically with php on a page.
Using jquery-ui-1.8.14.custom.min.js and jquery-1.5.1.min.js
Goal:
I’d like to be able to click on a row which would update the Jquery Ui dialog div with new content from a php page and then display this content in the Jquery Ui dialog box.
$(function(){
$('tr').live('click', function(){
$('.ui-dialog').load('<?php echo base_url();?>index.php/a/b/1');
$('.ui-dialog').dialog('open');
});
});
This code makes the dialog appear and disappear very fast without halting.
I’ve also tried the following which I thought would work:
$(function(){
$('tr').live('click', function(){
$('.ui-dialog').load('<?php echo base_url();?>index.php/a/b/1',
function(){
$('.ui-dialog').dialog('open')
});
});
});
Dialog code:
$(function(){$('.ui-dialog').dialog({
autoOpen: false,
width: 600,
draggable: true,
resizable: true,
open: function(){
$('.ui-widget-overlay').fadeIn();},
beforeClose: function(){
$('.ui-widget-overlay').fadeOut();},
show: "fade",
hide: "fade",
buttons: {
"Back to search": function() {
$(this).dialog("close"); }
}
})});
Any help is very much appreciated. Thanks.
when you initialise like :
It adds HTML to the
.ui-dialogwhen you.load()it removes it.What you need to do is either put the initialise code after the ajax load or:
http://jsfiddle.net/hgeYs/4/