help. I’m quite new to JS and currrently i’m still learning in passing variable between App Script to HTML and vice versa.
I have the following hello to be displayed in HTML
function test(){
Logger.log("Test is called logger")
console.log("Test is called console")
return "hello"
}
here’s how i call the html:
function doGet() {
var text = test()
var htmlnya = HtmlService.createTemplateFromFile("Warna")
htmlnya.test = text
return htmlnya.evaluate().getContent()
}
and here’s the html page:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap demo</title>
</head>
<body>
<script>
<?= test?>
</script>
</body>
</html>
i’m quite confuse because some people would use google.script.run.test() and i’m trying to pass the variable using evaluate()
I would expect hello would be printed in my html page.
update:
changed the html:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap demo</title>
</head>
<body>
<script>
test
</script>
</script>
</body>
</html>
and it returns
The script completed but the returned value is not a supported return type.