0
我已經在iFrame中一個簡單的形式提交給GAS Web應用程序:消息形式的iFrame提交後,與谷歌腳本的doPost
<form action="https://script.google.com/macros/s/AK...a4/exec" method="POST">
Name:<br>
<input type="text" name="name">
<br>
Email:<br>
<input type="email" name="email" value="">
<br><br>
<input type="hidden" name="product" value="Inv">
<input type="submit" value="DOWNLOAD" style="margin:0px auto; display:block; width: 10em; height: 2.4em;">
</form>
我想從的doPost服務發回的iFrame的消息,爲例如:
function doPost(e) {
...
var response = "<HTML><BODY><H1>Error processing request</H1><BR><BR><P>Missing or invalid parameter in request.</P></BODY></HTML>"
return ContentService.createTextOutput(response).setMimeType(ContentService.MimeType.TEXT);
}
但是,iFrame在提交後被清空,並且從不顯示我的消息。我錯過了什麼?
謝謝!
謝謝!我根據您提供的示例鏈接對GAS中的doGet實施了XMLHttpRequest - 客戶端iFrame沒有收到任何響應。顯然這是谷歌已知的不支持的功能:https://code.google.com/p/google-apps-script-issues/issues/detail?id=1563似乎我沒有辦法實現雙向HTTP溝通在這裏... –
我也試着用JSONP實現,但是響應沒有通過瀏覽器,可能是因爲谷歌重定向。 https://developers.google.com/apps-script/guides/content#serving_jsonp_in_web_pages –