title: window open does not work after form submit
body: <p>I have the following function to commit the values to a mysql database. The php ajax call works fine. But after the insert function, it does not execute the code related to window.open where it should go to index.html page.</p>
  
  <pre><code>function sendval(){
  var tosubmit = validateForm();
  if(tosubmit){
      showprog();
  
      // now create the json string to insert in the database
     var myData = {};
     myData.EmpName=localStorage.getItem("username");
     myData.LeaveType = $( "#leavetype option:selected" ).text();
     myData.LeaveStart = $('#txtFromDate').val();
     myData.LeaveEnd = $('#txtToDate').val();
     myData.ContactNum = $('#contactnum').val();
     myData.Comments = $('#Comments').val();
     myData.UsrMail = localStorage.getItem("usermail");
     myData.SupMail = localStorage.getItem("supmail");
     myData.Status = 'Submit';
  
      var myjson = JSON.stringify(myData);
      $.ajaxSetup( { "async": false } );
      $.ajax({
      method: "POST",
      url: "submitleave.php",
      data: {"points": myjson}
      })
      .done(function( msg ) {
          if(msg == 'Success') {
              alert("Submission successful");
          } else {
              alert("Could not sumbit - try again");
          }
          $.ajaxSetup( { "async": true } );   
          window.open("index.html","_self");
      }); 
    } else {
          alert("Please enter valid values before submitting the form");
    }
  
  }
  </code></pre>
  
  <p>I tried a few iterations but do not seem to get the error.</p>
  
  <p>Some of the other functions do not work as well.</p>
  
  <pre><code>&lt;header&gt;XXXXX&lt;br&gt;
  &lt;br&gt;&lt;input type="button" value="Logoff" id="logoff"&gt;
  &lt;/header&gt;
  
  $('#logoff').click(function(){
     localStorage.clear();
     window.open("index.html","_self");
  });
  </code></pre>
  
  <p>Regards,</p>