【问题标题】:Parameter passing to webapp on doGet(e)在 doGet(e) 上将参数传递给 webapp
【发布时间】:2013-02-06 18:56:08
【问题描述】:

我试图弄清楚 URL 中的参数如何传递给doGet() 函数。 我试着做

https://script.google.com/a/macros/[my domain].com/s/[some random string generated by GAS] 后跟"&variable=data"

但它只给了我这个错误: “抱歉,您请求的文件不存在。”

仅供参考,https://script.google.com/a/macros/[my domain].com/s/[some random string generated by GAS] 没有"&variable=data". 也能正常工作

【问题讨论】:

  • 你是如何发布的?
  • 抱歉我暂时的错误答案,是为了另一个帖子;-)

标签: google-apps-script


【解决方案1】:

要将 GET 参数添加到 URL 的末尾,您需要使用 ?

所以你的网址应该是这样的

http://script.[.......]/exec?variable=data&otherVariable=otherData

另外,请务必发布您的应用以获得此功能。文件 > 管理版本。发布 > 发布为 Web 应用程序...

【讨论】:

  • 如果您使用的是“开发”版本的脚本,也可以添加这些参数。 (这是发布界面中的“测试您的最新代码”选项)。看起来像这样http://script.[...]/dev?variable=data
  • 如何访问脚本中的这些参数值?
猜你喜欢
  • 2015-01-06
  • 1970-01-01
  • 2018-04-05
  • 1970-01-01
  • 1970-01-01
  • 2011-07-29
  • 2019-06-18
  • 2015-01-25
  • 1970-01-01
相关资源
最近更新 更多