afe*_*ows 2 jquery jquery-ui-dialog page-refresh
我在stackoverflow中搜索了这个问题并且看到了类似的问题(但不完全是我正在寻找的),但解决方案似乎不起作用.我只是jQuery的新手,我需要你的帮助才能做到这一点.(交叉手指)
所以我有一个带有按钮的网页(例如,parentPage.html).单击该按钮(执行openItemPopup函数)时,它将使用jQuery UI打开模式对话框.模态对话框"#contentWindow"的内容是一个不同的页面(例如modalDialog.html).
function resetContent() {
$('#contentFrame').attr('src', '/images/ajax-loader.gif');
}
function closeContent() {
$('.ui-dialog-titlebar-close').click();
}
function openItemPopup(){
$('#contentWindow').dialog({width:980, modal: true,
        close: function(ev, ui) { resetContent(); }
});
}
在modalDialog.html中,当单击一个锚点时,它会执行一些逻辑,并且需要动态关闭模态对话框.有人告诉我使用它,这已经有效了:
              // refresh parent page before closing
              // doesn't work
              location.reload(true);
              // close the modal dialog
              window.top.closeContent();
              return false;
              window.location='javascript:void();';
我的问题是:我需要在关闭模式对话框之前刷新parentPage.html.您在上面看到我尝试使用location.reload(true);,但它重新加载模式对话框而不是parentPage.html.我无法发布图片,但它说*"无效的Web应用程序会话".*
我也试过了window.top.location.reload(); 它似乎工作.它重新加载parentPage.html并关闭模式对话框.
              // refresh parent page before closing
              // seems working but has error
              window.top.location.reload();
              // close the modal dialog
              window.top.closeContent();
              return false;
              window.location='javascript:void();';
但是,它说"无效的Web应用程序会话". - 就像使用location.reload(true);时一样.我不知道为什么会这样,以及如何解决它.我甚至不确定window.top.location.reload是否是正确的方法.
仅供参考:我正在尝试刷新parentPage.html以便能够从模态对话框中获取数据.之前,modalDialog.html曾用作简单的html页面.列表和字段等数据从modalDialog.html正确返回到parentPage.html.他们想将其转换为模态对话框以防止大量页面刷新.有人告诉我,可以使用AJAX,但这是很多工作.此外,我不是主人.如果您有更好的建议,请随时告诉我!
我希望你能帮助我解决这个问题.提前致谢!!!