Westside2004
asked on
jQuery Dialog Won't Open Twice
Hi,
I'm loading a jQuery dialog with content AJAX style, and my dialog opens fine the first time, but not the second time. I can get it to open as many times as I want ONLY if I have my dialog div on the same page, but int this case, I have my one page with the dialog, but the content is pulled in via the "success" call from the ajax.
I have a tabular grid with rows of data. In one of the columns there is a button, the user clicks this button and it calls the below function "showMyWindow()".
I'm calling dialog('open') as you can see on line 29, but it won't open the second time. Here is my code:
I'm loading a jQuery dialog with content AJAX style, and my dialog opens fine the first time, but not the second time. I can get it to open as many times as I want ONLY if I have my dialog div on the same page, but int this case, I have my one page with the dialog, but the content is pulled in via the "success" call from the ajax.
I have a tabular grid with rows of data. In one of the columns there is a button, the user clicks this button and it calls the below function "showMyWindow()".
I'm calling dialog('open') as you can see on line 29, but it won't open the second time. Here is my code:
function showMyWindow(someValue) {
var url = "view/ajaxcontent.php";
var tag = $("<div></div>");
$.ajax({
url: url,
cache: false,
type: "POST",
data: { customerId: someValue },
success: function(data) {
tag.html(data).dialog({
modal:true,
cache: false,
title: 'Customer Information',
autoOpen: false,
closeOnEscape: true,
width: 350,
height: 250,
zIndex: 5000,
buttons: false,
position: "center",
close: function(event, ui) {
$(this).dialog("close");
}
}).dialog('open');
} // close success
}); // close ajax
return false;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.