0

I send parameter value from url to html in appsscript, but does not recognize it. I have trouble passing the value of a variable from a parameter in the url to a html appscript.

Could you please help me, I've tried everything and does not work. Show an example below

Url

https://script.google.com/a/<#######>/s/<script>/exec?clave=hola

Código.gs

function doGet(e) {
  var template = HtmlService.createTemplateFromFile('Index');
  template.clave=e.parameter.clave

  return template.evaluate()
      .setTitle('page')
      .setSandboxMode(HtmlService.SandboxMode.IFRAME);
}

Index.html

<!DOCTYPE html>
<html>
    <body>
<label for="id-cfolio" id="id-lfolio">field  : </label><input type="text" size="6"  id="id-cfolio" readonly  />
</body>
</html>

JavaScript.html

$(document).ready(function(){
document.getElementById("id-cfolio").value = clave; 

}
4
  • 1
    This question was crossposted to Stack Overflow en Español with a different user account. Ask that your accounts be merged. To learn how, see stackoverflow.com/help/merging-accounts Commented Jun 14, 2016 at 1:56
  • Related: stackoverflow.com/questions/35738587/… Commented Jun 14, 2016 at 2:02
  • Hi, thanks Ruben, yes I see the related question, but, I can't make it works. I have 2 days making changes and I don't known that is wrong. Commented Jun 14, 2016 at 3:49
  • Please take a look to the answer that I posted to the crosspoted question: es.stackoverflow.com/a/13857/65 Commented Jun 14, 2016 at 10:09

1 Answer 1

0

Javascript:

$(document).ready(function(){
document.getElementById("id-cfolio").value = <?=clave?>; 

}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.