我正在尝试通过Google应用脚本编写BMI HTML网站代码。但是,结果始终不会由doPost出现。我的代码如下:
代码
function doPost(e){
var h= e.parameter.h;
var w = e.parameter.w;
return
HtmlService.createHtmlOutput("bmi="+w/((h*h)/10000));
}
function doGet(e)
{
var t = HtmlService.createTemplateFromFile('Index');
t.serviceUrl = ScriptApp.getService().getUrl();
return t.evaluate();
}
Run Code Online (Sandbox Code Playgroud)
Index.html
<html>
<body>
<form id="bmiForm" action="<?= serviceUrl ?>" method="post">
<div>height(cm): <input type="text" name="h"/></div>
<div>weight(kg): <input type="text" name="w"/></div>
<input type="submit" value="submit"/>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
寻找答案