2021年3月31日星期三

Apps script values doesn't return from spreadsheet to html

I have html where I need load data from spreadsheet, but values doesn't load.

in these inputs Issue is values don't return to inputs in function callback(e). at html script doesn't load data, but Console log shows info:

document.getElementById('QPLAN').innerHTML = QP  document.getElementById('QFACT').innerHTML = QF;     

Script worked before but now it stoped to work.

Please, help! Thank you!

Script where innerHTML doesn't work:

      <script>        function refreshQ() {          google.script.run.withSuccessHandler(callback).GetQ(userInfo);        }          function callback(e) {          var QP= 70, QF = 10          document.getElementById('QPLAN').innerHTML = QP;          console.log(e.QPLAN);          document.getElementById('QFACT').innerHTML = QF;          console.log(e.QFACT);        }          function setFocus(){          refreshQ();        }            document.addEventListener("DOMContentLoaded", setFocus(idElem));        </script>
          <!doctype html>      <html lang="en">      <head>          <base target="_top">          <meta charset="UTF-8">          <meta name="viewport"                content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">          <meta http-equiv="X-UA-Compatible" content="ie=edge">          <title>PUT@WAY ST@RT</title>          <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet"                integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">          <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js"                  integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0"                  crossorigin="anonymous"></script>          <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.6.0/dist/umd/popper.min.js"                  integrity="sha384-KsvD1yqQ1/1+IA7gi3P0tyJcT3vR+NdBTt13hSJ2lnve8agRGXTTyNaBYmCR/Nwi"                  crossorigin="anonymous"></script>          <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.min.js"                  integrity="sha384-nsg8ua9HAw1y0W1btsyWgBklPnCUAFLuTMS2G72MMONqmOymq585AcH49TLBQObG"                  crossorigin="anonymous"></script>          <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>                      <script>          </script>        </head>        <body>        <div class="container">            <div class="row">                <div class="col-md-3"></div>                <div class="col-md-6">                    <form class="row needs-validation" novalidate>                                    <div class="row">                            <div class="col">                                <div class="form-floating">                                    <input type="text" class="form-control" id="QPLAN"  >                                    <label for="QPLAN">PLAN:</label>                                </div>                            </div>                            <div class="col">                                <div class="form-floating">                                    <input type="text" class="form-control" id="QFACT" >                                    <label for="QFACT">FACT:</label>                                </div>                            </div>                            <div class="col">                                <button type="button" class="btn btn-primary" id="retB" style="width: 100%; height: 100%">TO                                    MAIN MENU                                </button>                            </div>                        </div>                    </form>                </div>            </div>        </div>        </body>      </html>
https://stackoverflow.com/questions/66883172/apps-script-values-doesnt-return-from-spreadsheet-to-html March 31, 2021 at 03:06PM

没有评论:

发表评论