jQuery UI对话框关闭时刷新父页面 [英] Refresh parent page when jQuery UI Dialog is closed

查看:98
本文介绍了jQuery UI对话框关闭时刷新父页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,每次关闭jQuery UI中的特定对话框时,我都希望刷新父页面.我该如何做到这一点.

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代码:

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


      $('#createTeamLink').click(function(e) {
          dlg.load('admin/addTeam.php');
          e.preventDefault();
          dlg.dialog('open');
      }); 
}); 

HTML代码:

<button href="" type="button" id="createTeamLink" class="btn btn-primary custom">Create Team</button>
<div id="createTeam" class="divider"></div>

在关闭对话框后,如何使主父页面刷新/重新加载?

How do I get the main parent page to refresh/reload after the dialog box is closed?

推荐答案

使用dialogclose事件( http://api.jqueryui.com/dialog/#event-close ).

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();
     }
  });

这篇关于jQuery UI对话框关闭时刷新父页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆