Reputation: 171
I have exhausted all possible permutations I could possibly try, like moving all of the .js code into the html, but the functions would not run from the doc' sidebar, in every run -click any of those buttons- I have to go back to the script's editor to run the sidebar. The script for functions I embedded in my html is:
function Check() {
google.script.run.results_run();
}
function Clear() {
google.script.run.results_clear();
}
<button type="button" class="c-btn c-btn--primary" onclick="javascript:Check();"> Check </button>
<a class="clear-highlights" onclick="javascript:Clear();">Clear highlights</a>
Upvotes: 1
Views: 149
Reputation: 38140
javascript:
from onclick="javascript:Check();"
and from onclick="javascript:Clear();"
as it's not needed. Better if you use an event listener instead of inline JavaScript.google.script.run
use withSuccessHandler
and withFailureHandler
.function Check() {
google.script.run
.withSuccessHandler(function(){
// if needed do something when the server side function runs succesfully
})
.withFailureHandler(function(error){
// if an error occurss on server side log the error into the console
console.error(error.message,error.stack);
}).results_run();
}
function Clear() {
google.script.run
.withSuccessHandler(function(){
// if needed do something when the server side function runs succesfully
})
.withFailureHandler(function(error){
// if an error occurss on server side log the error into the console
console.error(error.message,error.stack);
}).results_clear();
}
Review the script execution page, there might be logged a server-side error.
Try disabling the new runtime (Chrome V8)
Resources
Related
Upvotes: 1