Ask questions and get good answers on mb.jQuery.components

I am using modal dailog box from jquery UI. I want to give ajax call to display the content in my dailog box.

$(function(){
$('#myLink').live("click",function(){
$('#lbContent').dialog('open');
var url= $(this).attr("href");

$('div#lbContent').empty();
$('div#lbContent').load(url);

       return false;

});

$('#lbContent').dialog({         
    stack:true,
    bgiframe: true,
    autoOpen: false,
    height:500,
    width:700,
    modal: true,
    resizable:true,
});

});

now, when i click on the link it displays the content in the modal dailog box as expected. but when i close that dailog box and again click on the same link then that dailog box is not coming. I tried to give alerts in between. When i refresh the page and click the link then it works as expected.

asked Nov 30 '09 at 05:15

Shruti's gravatar image

Shruti
313

edited Nov 30 '09 at 22:03

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1776129


Try that way:

$(function(){
   $('#lbContent').dialog({                
        stack:true,
        bgiframe: true,
        autoOpen: false,
        height:500,
        width:700,
        modal: true,
        resizable:true,
   });

$('#myLink').live("click",function(){
     $('div#lbContent').empty();
     var url= $(this).attr("href");
     $('div#lbContent').load(url,function(){
         $('#lbContent').dialog('open');
     });
       return false;
});

Or take a look at: http://pupunzi.open-lab.com/mb-jquery-components/mb-containerplus/

answered Nov 30 '09 at 22:18

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1776129

Your answer
toggle preview

jQuery main site - Matteo Bicocchi