现在有3个页面。A.aspx,B.aspx,C.aspxA页面通过showModalDialog()弹出页面B,在页面B的页面load时候用ajax去请求页面C中得数据。就在B用ajax请求C的时候出现了错误,IE报错是“拒绝访问” firefox 中不报错但是没有响应数据。为啥?

解决方案 »

  1.   

    是跨域了吗?js不能跨域
    如果没有跨域的问题, 你可以这样实现
    A页面通过showModalDialog()弹出页面X.aspx
    X.aspx里面写
    <html><frameset id="sidebar_content" cols="0, *">
        <frame src="" />
        <frame src="B.aspx"/>
    </frameset>
    </html>
      

  2.   

    另外,showModalDialog缓存很厉害,注意清空缓存
      

  3.   

    firefox 不支持showModalDialog吧?
      

  4.   

    在A 页面中调用这样的方法:
    function showHABDialog()
    {
       showModalDialog("http://localhost:1211/hab/A.aspx");
    }  
    在B页面中:
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"> 
        </script>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#b01").click(function () {
                    htmlobj = $.ajax({ url: "http://localhost:2464/C.aspx", async: false });
                    $("#myDiv").html(htmlobj.responseText);
                });
            });
        </script>
    </head>
    <body>
        <div id="myDiv"><h2>Let AJAX change this text</h2></div>
    <button id="b01" type="button">Change Content</button>
    </body>
    </html>
    在C页面中
    只用一行代码  Response.Write("server resource");
    三个网页是部署在一台IIS上的不同应用程序
      

  5.   

    恩,但是我不能这么做,其实这里的C页面是我们的wcf服务库,我为了简化模型这么说的,页面B会向C发出多次请求的。
      

  6.   

    好吧谢谢楼上的,我已经找到原因了,这样是可以访问的,但是B页面是ssl部署的,c不是ssl部署。
    https:/XXX 去访问 http:// 就出错了