Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6011225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:13:46+00:00 2026-05-23T02:13:46+00:00

I have a button that when clicked loads an external page (same domain) in

  • 0

I have a button that when clicked loads an external page (same domain) in to a div and displays that div as a jQuery UI dialog box.

<div id="Dialog_box"></div>

<script type="text/javascript">
    $(function() {
        $("#Dialog_box").dialog({
            autoOpen: false,
            modal: true,
            width: 500,
            height: 400,
            title: "Dialog",
            close: function(event, ui) {
                $("#Dialog_box").html(""); // Ensure the page is no longer loaded
            }
        });
    });

    function openDialog() {
        $(document).ready(function() {
            $("#Dialog_box").load("dialog.php").dialog('open');
        });
    }
</script>

<button onclick="openDialog();">Open Dialog</button>

The first time the button is clicked it opens fine. After closing it then it will no longer come back up.

First I verified that it was in fact being closed upon hitting the ‘X’

$("#Dialog_box").dialog({
    ...
    close: function(event, ui) {
        alert("Closed");
    }
});

And the alert was being shown. I then tried using my normal code but did not load in the page

$("#Dialog_box").dialog('open');

At this point, the dialog would open and close properly without any problems. Although I don’t believe it should matter, I even tried separating out the load and dialog commands

    function openDialog() {
        $(document).ready(function() {
            $("#Dialog_box").load("dialog.php");
            $("#Dialog_box").dialog('open');
        });
    }

Once again, the box would display the first time but would not reappear after that.

My external file essentially looks like this

<link type="text/css" href="path/to/style.css" rel="stylesheet" />
<script type="text/javascript" src="path/to/jquery.js"></script>
<script type="text/javascript" src="path/to/jquery-ui.js"></script>

<script type="text/javascript">
$(document).ready(function() {
    $("#Submit_button").click(function() {
        // Do stuff with form data
        // POST data without changing page
    });
});
</script>

<form action=''>
    // Input fields
    <input type="button" id="Submit_button" />
</form>

Just for clarification, the problem occurs whether or not I post my form.

Why won’t the dialog box re-open after I’ve loaded (and to my understanding, unloaded) a page in to it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:13:46+00:00Added an answer on May 23, 2026 at 2:13 am

    Remove the line to embed jquery.js from the external file.
    This line will load jQuery again, overwrite the existing jQuery, what will destroy the already instantiated dialog-object, because it’s registered in the overwritten jQuery-instance.

    To clarify: you don’t need to embed jquery and jqueryui again, because if you use $.load() the returned fragment will be a part of the DOM of the requesting document(they already exist there).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a button that opens a dialog when clicked. The dialog displays a
I have a usercontrol that hides a div when a button is clicked. <asp:LinkButton
I have this div that is supposed to be hidden when the page loads
With ASP.NET MVC3 (Razor) I have a simple page that loads a jQuery UI
I have a Button that when clicked loads a Flex module in my AIR
I have button and when I click it a html page loads to div
I have a button that loads more data into a datagrid when clicked. To
I have a button that when clicked will run a stored procedure on a
In my Silverlight UI, I have a button that when clicked pops up a
In my Delphi Project i want to have a 'Settings' button that when clicked,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.