jQuery Dialog Won't Open Twice

Posted on 2012-09-19
Medium Priority
Last Modified: 2012-09-22

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>");

				url: url,
				cache: false,
				type: "POST",
				data: { customerId: someValue },
				success: function(data) {
						cache: false,
						title: 'Customer Information',
						autoOpen: false,
						closeOnEscape: true,
						width: 350,
						height: 250,
						zIndex: 5000,
						buttons: false,
						position: "center",
						close: function(event, ui) {
				} // close success
			}); // close ajax
		return false;

Open in new window

Question by:Westside2004
1 Comment
LVL 25

Accepted Solution

Luis Pérez earned 1800 total points
ID: 38416711
You must destroy it before showing again. Replace your

close: function(event, ui) {


close: function(event, ui) {

Hope that helps.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question