title: Dismiss bootstrap modal without page refresh when contact form is submitted
body: <p>A <a href="https://stackoverflow.com/questions/29754902/close-bootstrap-modal-after-submit">similar question</a> exists on SO. The reason I'm still posting this is because I am not using any AJAX like the OP of that question. My situation involved the form being submitted to a PHP script that sends the email. Here's the form:</p>
  
  <pre><code>&lt;!-- Modal for contact form --&gt;
      &lt;div class="modal fade" id="contact" role="dialog" tabindex="-1"&gt;
        &lt;div class="modal-dialog"&gt;
          &lt;div class="modal-content contact-box"&gt;
            &lt;form class="form-horizontal" role="form" name="contact-form" id="contact-form" action="contact.php" method="post"&gt;
                &lt;div class="modal-header contact-title"&gt;
                  &lt;img src="bootstrap/img/airmail.png" class="airmail"&gt;
                  &lt;h4&gt;Let‘s get talking!&lt;/h4&gt;
                &lt;/div&gt;
                &lt;div class="modal-body contact-body"&gt;
                  &lt;div class="form-group has-feedback"&gt;
                    &lt;label for="contact-name" class="col-xs-2 control-label contact-label"&gt;Name&lt;/label&gt;
                    &lt;div class="col-xs-10"&gt;
                      &lt;input type="text" class="form-control contact-field contact-field-single" name="contact-name" id="contact-name" placeholder="John Doe" OnMouseOver="$(this).focus();"&gt;
                      &lt;i class="glyphicon glyphicon-user form-control-feedback input-icon"&gt;&lt;/i&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group has-feedback"&gt;
                    &lt;label for="contact-email" class="col-xs-2 control-label"&gt;Email&lt;/label&gt;
                    &lt;div class="col-xs-10"&gt;
                      &lt;input type="email" class="form-control contact-field contact-field-single" name="contact-email" id="contact-email" placeholder="example@domain.com" OnMouseOver="$(this).focus();"&gt;
                      &lt;i class="glyphicon glyphicon-envelope form-control-feedback input-icon"&gt;&lt;/i&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                    &lt;label for="contact-message" class="col-xs-2 control-label"&gt;Message&lt;/label&gt;
                    &lt;div class="col-xs-10"&gt;
                      &lt;textarea class="form-control contact-field" name="contact-message" rows="10" placeholder="No links please. They are bad and look like spam. Other than that, nothing should be taboo here!" OnMouseOver="$(this).focus();"&gt;&lt;/textarea&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
                &lt;div class="modal-footer contact-footer"&gt;
                  &lt;a class="btn btn-default btn-lg contact-close" data-dismiss="modal"&gt;Close&lt;/a&gt;
                  &lt;button type="submit" name="submit" id="submit" class="btn btn-primary btn-lg contact-send"&gt;Send&lt;/button&gt;
                &lt;/div&gt;
            &lt;/form&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>And here's the PHP this form calls:</p>
  
  <pre><code>$name = $_POST["contact-name"];
  $email = $_POST["contact-email"];
  $message = $_POST["contact-message"];
  
  $EmailTo = "contact@peppyburro.com";
  $Subject = "New Message Received";
  
  mail($EmailTo, $Subject, $message, "From: ".$name." &lt;".$email."&gt;");
  </code></pre>
  
  <p>I am currently not performing any validation. All I need is to dismiss the form when the submit button is clicked. I tried <code>header("Location: {$_SERVER['HTTP_REFERER']}");</code> in my PHP but that doesn't serve the purpose as it reloads the previous page which I want to avoid at all cost. I also tried adding <code>data-dismiss="modal"</code> to my submit button as suggested by the accepted answer on the referred question but that prevents the submission altogether!</p>