weixin_33737134 2013-03-11 06:26 采纳率: 0%
浏览 37

在IE7中启用Javascript

I have a Html file locally with the following code

            <h1>This is session token </h1>
            <div id="noob"></div>

          <script src="http://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></script> 
        <script>
        $(document).ready(function(){
        var sessiontoken;
         var randomUser = Math.round(Math.random() * 1000000);
             var supportCors = $.support.cors;
                       var sessiontoken ;

                       $.support.cors = true;

            $.ajax({
                           type: 'POST',
                           url: "https://abc.com/Gateway.Session/Session",
                           dataType: "json",
                           data: {
                               UserId: "TestUser" + randomUser,
                               CSK1: "abc",
                               CustId: "cde"
                           },
        success: function (data) {

                            $.support.cors = supportCors;
                            sessiontoken=data.Token;
                            alert(sessiontoken);
                            document.getElementById('noob').innerHTML = sessiontoken;

                           },
                           error: function (xhr, textStatus, error) {
                               $.support.cors = supportCors;
                                  alert("responseText: " + xhr.responseText);
                               alert("XHR statusText: " + xhr.statusText);
                               alert("textStatus: " + textStatus);
                               alert("error: " + error.message);
                           }


            });
          });

        </script>

This code when run locally(ex: c:/development/mypage.html) is generating session token after enabling the pop-up 'allow running javascript' " of IE7. i.e., ajax function in above javascript is returning 'success' when run locally and session token is generated. But when this code is deployed in server and opened in IE7 like (http:// localhost:8080/mypage.html), here ajax function of above script is returning 'error'.

As when we run the file locally we enabled the pop-up to allow running script. But when the file is deployed in server we won't get such pop-up as javascript runs itself when a html page is accessed from server. I am unable to figure out why control going to 'error' part o 'success' when we file from server

So how can i make this ajax function to return to 'success' part when accessed from server.

The file executes fine in chrome when accessed locally or from server.Now i need it to be working with IE7.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 matlab求解平差
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料
    • ¥15 使用R语言marginaleffects包进行边际效应图绘制
    • ¥20 usb设备兼容性问题
    • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
    • ¥15 安装svn网络有问题怎么办