title: jquery execute function while ajax response is loading
body: <p>How can I execute a function that will run while the client is waiting for the server response? Here is my code. I looked up and found a .load() function, but how does that fit into this? Any help would be great! Thanks</p>
  
  <pre><code>$.ajax({
      type: "POST",
      url: "mail.php",
      data: {name: name.val(), email: email.val(), phone: phone.val(), subject: subject.val(), message: message.val()}
      }).done(function(){
          alert("Your message was sent. We will be in contact with you shortly.");
          window.location="index.html";
  });
  </code></pre>