passing parameter from HTML javascript button to Google Apps Script stackoverflow

Recent Questions - Web Applications Stack Exchange

I tried this tutorial, but it was not written for v8-- and the logger and javascript parameter passing between html and the script doesn't work. https://www.youtube.com/watch?v=RRQvySxaCW0 I learned how to use the older rhino version of google apps script, but am unable to get variables to pass from HTML to the script.

In the second part, they give an example of using javascript to pass the username to the script. Inside the HTML file I have this:

var usname = document.getElementById("username").value;
    google.script.run.userClicked(usname);

and in the script I have:

function userClicked(uname){
  Logger.log(uname + " clicked");
}

But I don't receive any data in uname. It says "undefined clicked" in the log. Any suggestions to get this to run?


Recent Questions - Web Applications Stack Exchange Recent Questions - Web Applications Stack Exchange by anjchang via Recent Questions - Web Applications Stack Exchange

No comments:

Post a Comment