jQuery的$ .getScript在Firefox中的行为是否有所不同?加载脚本后未执行脚本,Chrome运行正常 [英] Does jQuery's $.getScript behave differently in Firefox ? It's not executing the script after loading it, Chrome is doing fine

查看:79
本文介绍了jQuery的$ .getScript在Firefox中的行为是否有所不同?加载脚本后未执行脚本,Chrome运行正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码

$.getScript("/js/dygraph-combined.js")
  .done(function(script, textStatus) {
    console.log(Dygraph);
  })
  .fail(function(jqxhr, settings, exception) {
    console.error('it failed to load');
  });

收益

未定义字形图

Dygraph is not defined

在Firefox 11.0和

in Firefox 11.0, and

[字图1.2]

[Dygraph 1.2]

在Chrome 17.0.963.83上.

on Chrome 17.0.963.83.

因此,该脚本似乎在两个浏览器上均已加载,但无法在Firefox 11中执行...为什么会这样?如何获得应有的表现?

So it seems that the script loads on both browsers but doesn't get executed in Firefox 11... Why would that be ? How do I get this behaving like it should ?

此脚本为 Dygraph ,并且在其网站上可以在Firefox上运行,但是我的图形只能在Chrome上运行,可能是因为jQuery $ .getScript的行为可能有所不同...

This script is Dygraph and from it's website it works on Firefox, but my graphs only work on Chrome possibly because jQuery's $.getScript might be behaving differently...

推荐答案

我遇到了同样的问题,在dygraph-combined.js中,它说这不是您要查找的文件".但是我无法使用绝地思维技巧,我点击了提供的链接.
http://dygraphs.com/dygraph-combined.js

I had the same issue and in the dygraph-combined.js it said "This is not the file you are looking for". but the jedi mind trick didn't work on me, I followed the link provided.
http://dygraphs.com/dygraph-combined.js

现在可以使用了:)

这篇关于jQuery的$ .getScript在Firefox中的行为是否有所不同?加载脚本后未执行脚本,Chrome运行正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆