title: web app to return boolean result to html from checking data in spreadsheet
body: <p>I have html page and script for check, the project deployed like web app</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;title&gt;CLR: PACKING&lt;/title&gt;
  &lt;meta charset = "UTF-8"&gt;
  &lt;meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"&gt;
      &lt;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"&gt;
      &lt;link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"&gt;
      &lt;link rel="stylesheet" href="/resources/demos/style.css"&gt;
      &lt;script src="https://code.jquery.com/jquery-1.12.4.js"&gt;&lt;/script&gt;
      &lt;script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;      
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div class="conteiner"&gt;
          &lt;form novalidate&gt;
                  &lt;h6 class="title"&gt;PACKING&lt;/h6&gt;
              &lt;div class="dws-input"&gt;
                  &lt;div class="col-md-3"&gt;&lt;/div&gt;
                  &lt;div&gt;
                      &lt;div&gt;
                          &lt;button id="del" type="button"&gt;&amp;lt;======RESET&lt;/button&gt;
                      &lt;/div&gt;
                      &lt;div class="form-floating mb-3 mt-3"&gt;
                          &lt;input type="text" class="form-control" novalidate id="tLogin" name= "username" placeholder= "Логин:" autofocus &gt; 
                          &lt;label for="tLogin"&gt;Login:&lt;/label&gt;
                      &lt;/div&gt;
                      &lt;div class="form-floating mb-3 mt-3"&gt;
                          &lt;input type="text" class="form-control"  novalidate id="tTable" name= "text" placeholder= "Номер стола:" &gt;
                          &lt;label for="tTable"&gt;Table:&lt;/label&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-floating mb-3 mt-3"&gt;
                      &lt;input type="text"  novalidate class="form-control" id="tOrder" name= "text" placeholder= "Заказ:" &gt;
                      &lt;label for="tOrder"&gt;Order:&lt;/label&gt;
                  &lt;/div&gt; 
              &lt;/div&gt;  
          &lt;/form&gt;
      &lt;/div&gt;
      
      &lt;?!= include("index-js"); ?&gt;
  
  &lt;/body&gt;
  
  
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>In included &quot;index-js.html&quot; I have this</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script&gt;
  
  inputs.addEventListener('keydown', keyPressFunction);
  
  function keyPressFunction(ev) {
  
    if (ev.code !== 'Enter') return;
  
    if (ev.target.id == "tLogin"){
      var findLogin = google.script.run.withSuccessHandler(onSuccess).searchLogins(ev.target.value);
      console.log(ev.target.value);
      console.log(findLogin);
    } 
  
    for (const i of formControl) {
      if (i.value === '') {
        i.nextElementSibling.focus();
        break;
      }
    }
  }
  
  function onSuccess(findLogin) {
     if(!findLogin) {return false} else {return true}
   }
  
  
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>this code send question to the apps script server where I have this:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function searchLogins(login){
          
    let sheetApp = SpreadsheetApp.getActiveSpreadsheet();
    let sheetTo = sheetApp.getSheetByName("SISTEM");
    let findingRLGN = sheetTo.getRange("A:A").getValues();
      for (let i = 0; i &lt; findingRLGN.length; i++){
        if(findingRLGN[i].indexOf(login)!==-1){
          return true;
        }
      }
      return false;
  }</code></pre>
  </div>
  </div>
  </p>
  <p>Totally I need to return the true/false result from onSuccess to var findLogin for next actions. May be here I need not this &quot;withSuccessHandler(onSuccess)&quot;? Thank you for help!</p>