Skip to content Skip to sidebar Skip to footer

Refresh Parent Page When Jquery Ui Dialog Is Closed

So every time a specific dialog box in jQuery UI is closed I want the parent page to be refreshed. How can I achieve this. jQuery Code: $(document).ready(function() {

Solution 1:

Use the dialogclose event (http://api.jqueryui.com/dialog/#event-close).

var dlg=$('#createTeam').dialog({
     title: 'Create a Team',
     resizable: true,
     autoOpen:false,
     modal: true,
     hide: 'fade',
     width:600,
     height:285,
     close: function(event, ui) {
          location.reload();
     }
  });

Solution 2:

You should be able to do this with the reload() function:

window.location.reload();

In your code:

var dlg=$('#createTeam').dialog({
     title: 'Create a Team',
     resizable: true,
     autoOpen:false,
     modal: true,
     hide: 'fade',
     width:600,
     height:285,
     close: function() {
         window.location.reload();
     }
});

Solution 3:

When you initialize the dialog, add the close listener.

$( ".selector" ).dialog({
  close: function( event, ui ) { window.location.reload(true); }
});

Post a Comment for "Refresh Parent Page When Jquery Ui Dialog Is Closed"