jQuery技术:关闭jQuery UI对话框时刷新父页面

因此,每次关闭jQuery UI中的特定对话框时,我都希望刷新父页面。 我怎样才能做到这一点。

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

  

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

    使用dialogclose事件( )。

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

    您应该可以使用reload()函数执行此操作:

     window.location.reload(); 

    在你的代码中:

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

    初始化对话框时,添加关闭侦听器 。

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

      以上就是jQuery教程分享关闭jQuery UI对话框时刷新父页面相关内容,想了解更多jQuery开发(异常处理)及jQuery教程关注计算机技术网(www.ctvol.com)!)。

      本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

      ctvol管理联系方式QQ:251552304

      本文章地址:https://www.ctvol.com/jquerytutorial/558852.html

      (0)
      上一篇 2021年2月1日
      下一篇 2021年2月1日

      精彩推荐