Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 谷歌';s onSuccessHandler没有响应_Javascript_Google Apps Script_Google Sheets_Handler - Fatal编程技术网

Javascript 谷歌';s onSuccessHandler没有响应

Javascript 谷歌';s onSuccessHandler没有响应,javascript,google-apps-script,google-sheets,handler,Javascript,Google Apps Script,Google Sheets,Handler,我在一个html文件中编写了一个javascript,该文件链接到我的谷歌电子表格。 这一切都很好,脚本做了它需要做的事情,从html中获取某些值并将其填充到工作表中的某些字段中,但是没有返回成功消息,用户被引导到一个空白页面 你知道怎么解决这个问题吗 HTML代码: <script> function onSuccess() {window.confirm("Your order was successfully sent");} function onFail

我在一个html文件中编写了一个javascript,该文件链接到我的谷歌电子表格。 这一切都很好,脚本做了它需要做的事情,从html中获取某些值并将其填充到工作表中的某些字段中,但是没有返回成功消息,用户被引导到一个空白页面

你知道怎么解决这个问题吗

HTML代码:

<script>
function onSuccess() {window.confirm("Your order was successfully sent");}
function onFailure() {window.confirm("Something went wrong. Please try again or contact the Customer Service.");}

function PR(){
if (window.confirm("Send Order?")) {

var k = document.getElementById('custname').value;
var l = document.getElementById('mayor').value;
var m = document.getElementById('ioc').value;
var n = document.getElementById('canpen').value;
var o = document.getElementById('date').value;
var p = document.getElementById('idcie').value;
var q = document.getElementById('totdes').value;

google.script.run.withSuccessHandler(onSuccess).withFailureHandler(onFailure).copyData(k,l,m,n,o,p,q);

} 
else {alert("You canceled your order, try again!");}
}

</script>

我可以问一下执行
PR()
函数的方法吗?尝试将不可为null的
return
语句添加到
copyData
函数中。当按下
F12
时,您可以使用控制台中的日志更新您的问题吗?hi@Tanaike:您对该方法的意思是什么?这是一个带有onclick ref的按钮,指向函数hi@Dmitro:我已经在函数中添加了一个返回,但是运气不好-你会怎么做?
function doGet(request) {
  return HtmlService.createTemplateFromFile('page')
      .evaluate();
      
}


function copyData(k,l,m,n,o,p,q) {
DB.getRange(1,3).setValue(l);
DB.getRange(1,4).setValue(m);
DB.getRange(1,5).setValue(p);
DB.getRange(1,6).setValue(n);
DB.getRange(1,7).setValue(o);
DB.getRange(1,8).setValue(q);

}