title: Google Apps Script: reload page after submit form
body: <p>I finally am at the finals steps of my app and there's just one thing I cannot figure out how to write: I'm using an iframe to load a page in Google Apps Script in which I have a form.</p>
  
  <p>I'm able to write data in a Google Spreadsheet and I get a successful message if data are correctly inserted. The only thing I cannot get is how to make refresh the frame after a few seconds to be sure the user read the message...</p>
  
  <p>Any help?</p>
  
  <p>Thanks a lot!</p>
  
  <p>That's my code (credits to <a href="https://stackoverflow.com/users/7215091/cooper">@Cooper</a> for helping me A LOT with this - he basically wrote the code)</p>
  
  <pre><code>    &lt;body&gt;
        &lt;div id="errorMessage" style="display:none;"&gt;
          &lt;h3&gt;Errore&lt;/h3&gt;
          &lt;p&gt;Tutti i campi devono essere compilati.&lt;/p&gt;&lt;/div&gt;
        &lt;div id="data"&gt;
            &lt;form name="reqForm" id="reqForm" method="post" action="" accept-charset="UTF-8"&gt;
                 &lt;label for="area"&gt;* Area&lt;/label&gt;
              &lt;select id="area"&gt;
                 &lt;option value=""&gt;--Seleziona--&lt;/option&gt;
                 &lt;option value="1"&gt;1&lt;/option&gt;
                 &lt;option value="2"&gt;2&lt;/option&gt;
                 &lt;option value="3"&gt;3&lt;/option&gt;
                 &lt;option value="4"&gt;4&lt;/option&gt;
                 &lt;option value="5"&gt;5&lt;/option&gt;
                 &lt;option value="6"&gt;6&lt;/option&gt;
              &lt;/select&gt;
              &lt;br /&gt;
                 &lt;label for="nome"&gt;* Oggetto:&lt;/label&gt;
              &lt;input type="text" id="oggetto" name="oggetto" /&gt;
              &lt;br /&gt;
              &lt;br /&gt;
                 &lt;label for="nome"&gt;* Nome:&lt;/label&gt;
              &lt;input type="text" id="nome" name="nome" /&gt;
              &lt;br /&gt;
                 &lt;label for="cognome"&gt;* Cognome:&lt;/label&gt;
              &lt;input type="text"  id="cognome" name="cognome" /&gt;
              &lt;br /&gt;
                 &lt;label for="mat"&gt;Matricola:&lt;/label&gt;
              &lt;input type="text" pattern="[0-9]{6}" id="mat" name="mat" /&gt;
              &lt;br /&gt;
                 &lt;label for="mail"&gt;* E-mail:&lt;/label&gt;
              &lt;input type="mail" id="mail" name="mail"/&gt;
              &lt;br /&gt;
                 &lt;label for="testo"&gt;* Richiesta:&lt;/label&gt;
              &lt;textarea id="testo" name="testo"&gt;&lt;/textarea&gt;
              &lt;br /&gt;
              &lt;button type="button" value="Invia" id="btnSend" class="button mainBtn"&gt;Invia&lt;/button&gt;
      &lt;/form&gt;
        &lt;/div&gt;
        &lt;div id="resp" style="display:none;"&gt;
          &lt;h3&gt;Inviato&lt;/h3&gt;
          &lt;p&gt;I tuoi dati sono stati registrati.&lt;br/&gt;Riceverai risposta all'indirizzo indicato.&lt;/p&gt;
        &lt;/div&gt;
          &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script&gt;
    $(function() {
      $('#btnSend').click(validate);
    });
  
    function setResponse(a)
    {
      if(a)
      {
        $('#data').css('display','none');
        $('#resp').css('display','block');
      }
    }
  
    function validate()
    {
          var area = document.getElementById('area').value;
          var n = document.getElementById('nome').value;
          var c = document.getElementById('cognome').value;
          var m = document.getElementById('mat').value;
          var em= document.getElementById('mail').value;
          var t = document.getElementById('testo').value;
          var o = document.getElementById('oggetto').value;
  
      var a = [n, c, m, em, area, o, t, "", "Ricevuta"];
  
      if(area &amp;&amp; n &amp;&amp; c &amp;&amp; em &amp;&amp; o &amp;&amp; t)
      {
        google.script.run
          .withSuccessHandler(setResponse)
          .getData(a);
          $('#errorMessage').css('display','none');
          return true;
      }
      else
      {
        $('#errorMessage').css('display','block');
      }
    }
  
    function loadTxt(from,to)
    {
        document.getElementById(to).value = document.getElementById(from).value;
    }
  
   console.log('My Code');
  </code></pre>
  
  <p>
    </p>