【问题标题】:Using jquery AJAX Post method in Google app script在 Google 应用脚本中使用 jquery AJAX Post 方法
【发布时间】:2019-11-02 04:17:48
【问题描述】:

我正在为 Google 表格使用 Google 脚本,我想在 google 脚本中运行 jQuery 代码或使用 google 应用程序脚本中的某些方法来执行以下操作:

var url = 'https://example.com/message?token=83763g87x';

var data = {
    money: '333', 
    body: 'Hello, Andrew!', // Message
};

// Send a request
$.ajax(url, {
    data : JSON.stringify(data),
    contentType : 'application/json',
    type : 'POST'
});

【问题讨论】:

标签: javascript jquery ajax google-apps-script google-sheets


【解决方案1】:

就是这样:

var url = 'https://example.com/message?token=83763g87x';

var data = {
    money: '333', 
    body: 'Hello, Andrew!', // Message
};

// Send a request
var options = {
  'method' : 'post',
  'contentType': 'application/json',
  // Convert the JavaScript object to a JSON string.
  'payload' : JSON.stringify(data)
};
UrlFetchApp.fetch(url, options);

【讨论】:

    猜你喜欢
    • 2014-07-30
    • 1970-01-01
    • 2016-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多