这是我的简单应用脚本。doPost 什么也不返回。但是,如果要发布代码以返回 UIApplication,那么它可以工作文件。
关于如何从 doPost 发送 HTML 输出的任何想法?
function doGet() {
var app = UiApp.createApplication();
var form = app.createFormPanel();
var flow = app.createFlowPanel();
flow.add(app.createTextBox().setName("textBox"));
flow.add(app.createSubmitButton("Submit"));
form.add(flow);
app.add(form);
return app;
}
function doPost(eventInfo) {
/* if i uncomment UiApp section then it works fine, But i want to send HTML, then the reponse is blank */
/*var app = UiApp.getActiveApplication();
app.add(app.createLabel("Form submitted. The text box's value was '" +
eventInfo.parameter.textBox + "'"));
return app;*/
/* the following returns just blank page */
outText = "<html><body><h1> Received Text = " + eventInfo.parameter.textBox+"</h1></body></html>";
return HtmlService.createHtmlOutput(outText);
}
所以问题是如何通过 doPost 发送 HTML ?看起来如果 doGet retuns UiApp 然后 doPost 必须返回 UiApp。这是限制还是我做错了什么?