【问题标题】:"Window not defined" error when running google apps script (UrlFetchApp)运行谷歌应用程序脚本(UrlFetchApp)时出现“未定义窗口”错误
【发布时间】:2017-11-14 07:37:13
【问题描述】:

我正在尝试为 Trello API 导入 client.js 库。 这样我就可以在我的代码中使用 Trello 对象及其方法。

运行此行时出现错误:

eval(UrlFetchApp.fetch('http://code.jquery.com/jquery-1.7.1.min.js').getContentText());

有没有办法修复这个错误/导入这个库?或者,因为GAS是服务器端,是不是不可能?

你有没有建议我导入这个库的另一种方法?

谢谢。

【问题讨论】:

  • 你为什么要使用eval()(这是邪恶的,应该很少使用,如果曾经使用过)?
  • 这个问题中提出了答案-stackoverflow.com/questions/18646554/…建议我用这个方法。
  • 您在服务器代码中混合了客户端代码。确保您事先清楚这两个概念。可以从气体中使用。

标签: javascript google-apps-script google-sheets trello


【解决方案1】:

我相信 jQuery 需要访问 document object model,这在 GAS 中不可用。您可能要考虑使用另一个不依赖于 DOM 存在的库,例如 Underscore

【讨论】:

    猜你喜欢
    • 2016-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-30
    相关资源
    最近更新 更多