简体   繁体   English

jQuery的加载页面到对话框

[英]jquery load page to dialog

I develop Intranet application with login via AD. 我通过AD登录来开发Intranet应用程序。 In my application I need load web page from another application on same server and show this page in dialog. 在我的应用程序中,我需要从同一服务器上的另一个应用程序加载网页,并在对话框中显示此页面。

$('#btnExample').click(function () {

var id = getCurrentId();
var url = 'http://SERVERNAME:81/Runtime/Forms/formDetail.aspx?SN=' + id;

                jQuery.support.cors = true;

                $('#pagePreview').load(url, function (response, status, xhr) {
                    alert(xhr.status + " " + xhr.statusText);
                });

                $('#pagePreview').dialog(
                    {
                        draggable:false,
                        height: 768,
                        width: 1024,
                        modal: true,
                    });

                return false;
            });

The load function throw error: Access Denied. 加载函数引发错误:访问被拒绝。 Why? 为什么? In my application is user logged by Active Directory and in the second app is logged too by AD... 在我的应用程序中,用户是由Active Directory登录的,而在第二个应用程序中,也是由AD登录的...

Is any other way to resolve it? 还有其他解决方法吗? I need display this page in my site in a dilog. 我需要在网站上以dilog显示此页面。 Thanks 谢谢

The second page is probably not on the same host as the first, so your request violates the "same origin policy". 第二页可能与第一页不在同一主机上,因此您的请求违反了“相同来源策略”。

As workaround, try an ajax request, load html into something, then populate the dialog with it. 解决方法是尝试ajax请求,将html加载到某些内容中,然后用它填充对话框。 If the request is still denied make a local php script that makes a curl request to the specified page, and make an ajax request towards that script. 如果仍然拒绝该请求,请执行向指定页面发出curl请求的本地php脚本,然后对该脚本进行ajax请求。

If it still fails... something is wrong. 如果仍然失败...出了点问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM