function doPost(e){
Logger.log(JSON.stringify(e));
const pr = JSON.stringify(e);
var a1 = pr.parameters.aoutlet;
AddRecord(a1);
}
// pr
//{"parameters":{"Bill-Amt":[""],"Vendor0":["ko"],"aoutlet":["GM"],"Vendor":["555"].....
它的應用程式腳本說...無法讀取未定義的屬性“aoutlet”(第 13 行,檔案“代碼”)
uj5u.com熱心網友回復:
在您的情況下,如何進行以下修改?
從:
function doPost(e){
Logger.log(JSON.stringify(e));
const pr = JSON.stringify(e);
var a1 = pr.parameters.aoutlet;
AddRecord(a1);
}
到:
function doPost(e){
Logger.log(JSON.stringify(e));
var a1 = e.parameters[0].aoutlet;
AddRecord(a1);
return ContentService.createTextOutput("ok");
}
要么
function doPost(e){
Logger.log(JSON.stringify(e));
var a1 = e.parameter.aoutlet;
AddRecord(a1);
return ContentService.createTextOutput("ok");
}
筆記:
- 當您修改 Google Apps 腳本時,請將部署修改為新版本。這樣,修改后的腳本就會反映在 Web Apps 中。請注意這一點。
- 您可以在“在不更改新 IDE 的 Web 應用程式 URL 的情況下重新部署 Web 應用程式”的報告中查看詳細資訊。
uj5u.com熱心網友回復:
問題:
您在物件上使用JSON.stringify ( ) ,字串也是如此。epr
然后,您嘗試訪問該字串中的屬性,就好像它是一個物件一樣,這會導致您的錯誤。
解決方案:
不要使用JSON.stringify. 改用e:
var a1 = e.parameters.aoutlet;
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/457219.html
