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

  • Home
  • SEARCH
  • 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 3974690
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:35:51+00:00 2026-05-20T04:35:51+00:00

I am using jQuery-UI dialog in modal modal mode to display several Edit forms

  • 0

I am using jQuery-UI dialog in modal modal mode to display several “Edit” forms on my page.

As of now the edit forms are loaded into the dialog div via and ajax call. Said forms are also submitted via ajax. The submit ajax function calls back to another function which updates the DOM of the main page with the new edited data.

My problem is that I lose the reference to the UI dialog after either of the DOM updates. The problem, then, is that I can no longer call methods on the the dialog (I.E. ‘close’).

If I reinitialize the dialog, I run into a problem where my form submitted via ajax makes all of its calls multiple times…as if the form is bound multiple times to the dialog.

Is there a way to get around this behavior and maintain my reference to the dialog after DOM updates?

Heres some code…
initialize the dialog on document ready…

$('#dialog').dialog({         
   autoOpen: false,         
   modal: true, 
   draggable: false, 
   resizable: false, 
   height: 450,
   width: 550,
 });

button click to open the dialog and load the edit form…

('#editInfo').live("click", function () {
     $('#dialog').dialog('open')
     $.ajax({
         type: 'GET',
         url: '../info/edit',
         data: {},
         success: function (response) {
             $('#dialog').html(response);//loads the partial edit view into the dialog div...works fine to here.
          }
     });
     return false;
 });

after the forms is submitted this function gets called on success to update dom and main page…

function infoUpdate(response) {
   $('#dialog').dialog('close');
   $('#info').html(response);
 } 

DOM gets updated fine after that call but the dialog does not close…

EDIT:
I should mention that I am using asp.net MVC 3. The edit form that is loaded into the dialog is a partial view, and the elements that get updated on the main page after the submit are also a partial view..not sure if this matters

EDIT 2
found a solution..posted as answer but having new issue(refer to answer below)

  • 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-20T04:35:51+00:00Added an answer on May 20, 2026 at 4:35 am

    I have fixed this by initializing the modal dialog inside the success function of the ajax call

    ('#editInfo').live("click", function () {
       $('#dialog').dialog('open')
       $.ajax({
          type: 'GET',
          url: '../info/edit',
          data: {},
          success: function (response) {
             $('#dialog').html(response);
             $('#dialog').dialog({         
                 autoOpen: true,         
                 modal: true, 
                 draggable: false, 
                 resizable: false, 
                 height: 450,
                 width: 550,
             });
    
          }
     });
     return false;
    

    });

    This allows the dialog to close when the submit callback fires which solves the problem I posed in my question. However, I am having issues with the form being submit multiple times in conjunction with the modal being opened multiple times….I.E. the form is submitted once for each time the dialog has been opened/loaded. This happens in spite of me explicity destroying the dialog within the form callback. I may need to open a new question for this issue unless someone has a quick fix…

    form submit callback…

    function infoUpdate(response) {
        $('#dialog').dialog('destroy');
        $('#info').html(response);
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the jquery dialog widget to display a modal box. However when
I am using jQuery UI dialog for modal popups. I have some iframes in
I am using jQuery to open a dialog window with a textarea transformed into
I am trying to open a modal jquery dialog using jquery 1.4 and jquery-ui-1.8rc3.custom.js
I'm using a jQuery modal dialog (see link ) with an element that uses
I'm using the jquery ui dialog for a modal popup dialog. It's working great
I am using jquery modal dialog, but the look of the dialog is other
I noticed that when I show up a modal dialog using Jquery UI in
I'm using a jQuery UI dialog to show a popup containing a page. When
I am using jQuery.ui.dialog.js to show the modal pop up.. But this Jquery.ui.dialog.js is

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.