weixin_33728268 2014-05-05 07:39 采纳率: 0%
浏览 30

用ajax加载脚本

I have a very strange problem. This function load a script on my IIS local web server.

function loadJs(scriptName) {
    var name = scriptName.toString();
    var myUrl = 'http://192.168.1.149/7.0.9.5/m/js/';
    myUrl += name;
    debugger;
    $.ajax({
        url: myUrl,
        dataType: "script",
        success: function () {  }
    });
}

When I check in debugger, I see that the url is correct.

enter image description here

But in fact, the ajax call doesn't use my url: enter image description here

While it should be this:

enter image description here

We can see that the request url is not the same. (The 403 code is normal because IIS block the access to the folder list).

On the other hand, if I directly put the url into the 'url' parameter, the load works.

function loadJs(scriptName) {
    var name = scriptName.toString();
    var myUrl = 'http://192.168.1.149/7.0.9.5/m/js/';
    myUrl += name;
    debugger;
    $.ajax({
        url: 'http://192.168.1.149/7.0.9.5/m/js/loadAccount.js',
        dataType: "script",
        success: function () {  }
    });
} 

enter image description here

If someone can propose an answer to this very strange problem. I'll be glad.

Thanks, in advance.

  • 写回答

2条回答 默认 最新

  • weixin_33725515 2014-05-05 07:44
    关注

    Try changing this line

    myUrl = myUrl + name;
    
    评论

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作