1

以下代码

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

产量

Dygraph 未定义

在 Firefox 11.0 中,以及

[Dygraph 1.2]

在 Chrome 17.0.963.83 上。

所以似乎脚本在两个浏览器上都加载但没有在 Firefox 11 中执行......为什么会这样?我怎样才能让它表现得像它应该的那样?

这个脚本是Dygraph,从它的网站上它可以在 Firefox 上运行,但我的图表只能在 Chrome 上运行,可能是因为 jQuery 的 $.getScript 可能表现不同......

4

2 回答 2

0

尝试做:

    $.getScript("http://dygraphs.com/dygraph-combined.js", function(script, textStatus) {
        setTimeout(function(){console.log(Dygraph);}, 0);
    }).fail(function(jqxhr, settings, exception) {
        console.error('it failed to load');
    });
于 2012-03-23T02:56:33.403 回答
0

我遇到了同样的问题,在 dygraph-combined.js 中它说“这不是您要查找的文件”。但是绝地思维技巧对我不起作用,我按照提供的链接进行操作。
http://dygraphs.com/dygraph-combined.js

现在它可以工作了:)

于 2012-05-15T21:45:21.813 回答