title: How to reload current page without losing any form data?
body: <p>Can I reload current page without losing any form data? I used..</p>
  
  <pre><code>window.location = window.location.href;
  </code></pre>
  
  <p>and </p>
  
  <pre><code>window.location.reload(true);
  </code></pre>
  
  <p>But these two things can't get earlier form datas for me. What is wrong ? When refresh browser manually, it is fine (I don't lose any form data).  Please guide me how to figure it out.</p>
  
  <p>Here is my full code...</p>
  
  <pre><code>&lt;div class="form-actions"&gt;
          &lt;form&gt;
              &lt;table cellpadding = "5" cellspacing ="10"&gt;
                  &lt;tr class="control-group"&gt;
                      &lt;td style="width: 100px;"&gt;
                          &lt;div&gt;Name:&amp;nbsp;&lt;font color="red"&gt;(*)&lt;/font&gt;&lt;/div&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;input type="text" id="inputName" placeholder="Name" required&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr class="control-group"&gt;
                      &lt;td&gt;
                          &lt;div&gt;Email:&amp;nbsp;&lt;font color="red"&gt;(*)&lt;/font&gt;&lt;/div&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;input class="span3" placeholder="user@gmail.com" id= "inputEmail" type="email" required&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr class="control-group"&gt;
                      &lt;td&gt;
                          &lt;div&gt;Phone:&amp;nbsp;&lt;/div&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;input type="text" id="inputPhone" placeholder="phone number"&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr class="control-group"&gt;
                      &lt;td&gt;
                          &lt;div&gt;Subject:&amp;nbsp;&lt;font color="red"&gt;(*)&lt;/font&gt;&lt;/div&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;input type="text" id="inputSubject" placeholder="Subject" required&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr class="control-group"&gt;
                      &lt;td colspan ="2"&gt;
                          &lt;div&gt;
                              &lt;div&gt;Detail:&amp;nbsp;&lt;/div&gt;
                              &lt;div class="controls"&gt;
                                  &lt;textarea id="inputDetail"&gt;&lt;/textarea&gt;
                              &lt;/div&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td colspan="2"&gt;
                      &lt;div&gt;
                          &lt;label style="font-weight: bold;" class="checkbox"&gt; &lt;input id="confirmCheck" value="" type="checkbox"&gt;
                                  I Agree to the Personal information handling policy
                          &lt;/label&gt;
                      &lt;/div&gt;
                      &lt;div id = "alert_placeholder"&gt;&lt;/div&gt;
                          &lt;div class="acceptment"&gt;
                              [Personal information handling policy]&lt;br&gt; &lt;br&gt;
                          &lt;/div&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td colspan="2"&gt;
                          &lt;div align="center"&gt;
                              &lt;button id="btnConfirm" class="btn btn-primary"&gt;Confirm&lt;/button&gt;
                              &lt;input type="reset" style="width: 65px; height: 27px;" id="btnReset" class="btn"&gt;
                          &lt;/div&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>And at my JS file..</p>
  
  <pre><code>function bind() {
  $('#btnConfirm').click(function(e) {
      if ($('#confirmCheck').is(":checked")) {
          getConfirmationForSendFAQ();
      }
      else {
          e.preventDefault();
          showalert("You should accept \"Personal Information Policy\" !", "alert-error");
      }
  });};function getConfirmationForSendFAQ() {
      var name = $('#inputName').val();
      var email = $('#inputEmail').val();
      var phone = $('#inputPhone').val();
      var subject = $('#inputSubject').val();
      var detail = $('#inputDetail').val();
  
      $('.form-actions').empty();
      html = [];
      html.push("&lt;table cellpadding ='8' class = 'submitInfo'");
      html.push("&lt;tr&gt;");
      html.push("&lt;td class = 'title'&gt;Name:&lt;/div&gt;");
      html.push("&lt;td class = 'value'&gt;"+ name +"&lt;/td&gt;");
      html.push("&lt;/tr&gt;");
  
      html.push("&lt;tr&gt;");
      html.push("&lt;td class = 'title'&gt;Email Address:&lt;/div&gt;");
      html.push("&lt;td class = 'value'&gt;"+ email +"&lt;/td&gt;");
      html.push("&lt;/tr&gt;");
  
      if (phone.trim().length &gt; 0) {
          html.push("&lt;tr&gt;");
          html.push("&lt;td class = 'title'&gt;Phone No:&lt;/div&gt;");
          html.push("&lt;td class = 'value'&gt;"+ phone +"&lt;/td&gt;");
          html.push("&lt;/tr&gt;");
      }
  
      html.push("&lt;tr&gt;");
      html.push("&lt;td class = 'title'&gt;Subject:&lt;/div&gt;");
      html.push("&lt;td class = 'value'&gt;"+ subject +"&lt;/td&gt;");
      html.push("&lt;/tr&gt;");
  
      html.push("&lt;tr&gt;");
      html.push("&lt;td class = 'title'&gt;Detail Info:&lt;/div&gt;");
      html.push("&lt;td class = 'value'&gt;"+ detail +"&lt;/td&gt;");
      html.push("&lt;/tr&gt;");
  
      html.push("&lt;tr&gt;");
      html.push("&lt;td colspan='2'&gt;&lt;div align = 'center'&gt;");
      html.push("&lt;button id='btnSend' class='btn btn-primary' style='width: 65px;'&gt;Send&lt;/button&gt;");
      html.push("&lt;button id='btnReturn' class='btn btn-inverse' style='width: 65px; height: 27px; margin-left: 5px;'&gt;Return&lt;/button&gt;");
      html.push("&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;");
  
      html.push("&lt;/table&gt;");
      $('.form-actions').append(html.join(''));
      $('#btnReturn').click(function(e) {
          // HERE I WANT TO KNOW HOW TO DO.....
      });
      $('#btnSend').click(function(e) {
          alert("Doom");
      });}
  </code></pre>