I'm triggering a function which is in a .gs file (google apps script), from my .js file using:
google.script.run.withSuccessHandler(function_In_JS_FILE).function_In_GS_FILE();
In the JS file the function to declare the global variable looks like this:
var newVariable ;
function function_In_JS_FILE(return_from_function_In_GS_FILE) {
window.newVariable = return_from_function_In_GS_FILE ;
console.log(newVariable) ; // It show the array that comes from the.gs file.
}
console.log(newVariable) ; // It shows 'Undefined'
It is supposed that using the 'window' method that variable should be global but it is not working... I will appreciate a lot your help! Thanks!