在Ajax调用中获取访问被拒绝错误

时间:2013-03-12 14:57:35

标签: javascript html ajax

我有以下在html页面中编写的javascript代码。这个html页面保存在桌面上,用于触发webservice;我从IE9浏览器运行这个,但从本周开始,我已经开始在“httpRequest.open”调用中收到“拒绝访问”错误。我已经尝试更改IE的安全设置但它不起作用。相同的代码用于一周之前工作,但仍然只适用于一个人,我们无法找出差异,因为所有浏览器设置都相同。

function invokeService(name,url) 
{   
    try 
    {
        alert("entering"); 

        if (window.ActiveXObject) 
        {
            alert("activex");
            httpRequest=new ActiveXObject("Microsoft.XMLHTTP"); 
        }
        else if(window.XMLHttpRequest) 
        {
            alert("xmlhttp");
            httpRequest=new XMLHttpRequest();
        } 

        alert("going to open"+url); 

        httpRequest.open('GET',url,true);

        alert("opened");

        if (httpRequest.overrideMimeType) 
        { 
            httpRequest.overrideMimeType("text/xml"); 
        }

        alert("Going to pd");

        httpRequest.onreadystatechange=populateDiv;

        alert("going to send");

        httpRequest.send();

        valTimeout=setTimeout("timeout(httpRequest);",1200000);        

    }
    catch(e) 
    { 
        alert("Error in invoke"+e.description); 
    }   
}  

0 个答案:

没有答案
相关问题