jQuery Dialog Won't Open Twice

Posted on 2012-09-19
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

    You must destroy it before showing again. Replace your

    close: function(event, ui) {


    close: function(event, ui) {

    Hope that helps.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
    Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
    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)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now