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.
".ui-dialog"... hidden I assume? Can you check that theload()is returning the correct html? and is successful? for example.load('<?php echo base_url();?>index.php/a/b/1',function(responseText){ alert(responseText); ...$(function(){$('tr').live('click', function(){$('.ui-dialog').dialog('open')})});Open dialog event handlers? As in the .dialog('close') etc?open: function{ ..but it looks safe. try putting areturn false;in your click event maybe it is bubbling and causing something else to run? I would still suggest it is your ajax call returning bad html or writing over something.