javascript - 如何将表单数据发布到 Google Apps 脚本

标签 javascript jquery forms google-apps-script

将表单数据从 HTML 页面发布到我的 GAS 脚本的最佳/最简单方法是什么?

$(document).ready(function() {
  $.getJSON(SCRIPT_URL+"?callback=?", { method:"addRow"}, function (data) { alert(JSON.stringify(data)); }); 
});

最佳答案

如果您使用 Apps 脚本 HTML 服务,则可以使用 google.script.run

Google Documentation - Client-side API - call server-side Apps Script functions

从 Google 外部的应用或网站,向 Apps 脚本 URL 发出 HTTP 请求。

关于javascript - 如何将表单数据发布到 Google Apps 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29696293/

相关文章:

javascript - 使用javascript提交一个django表单

javascript - 井字游戏 : Sqaure cannot be overridden

javascript - 在javascript中将单词拆分为音节

传递到各个动画的各个元素的 javascript 变量

javascript - 使用 Val() 作为参数时返回对象而不是字符串

javascript - extjs4:如何提交相同的表单数据两次

javascript - PostgreSQL。第一次处理插入,第二次尝试选择但未找到

javascript - JavaScript 中的全局变量到局部变量

javascript - React 中的 JSON 对象解析问题

javascript - 从 javascript 中的 for() 中排除一个以 'ElementByName' 结尾的数组