title: Load modal after form submit
body: <p>Relevant page here:
  <a href="http://marcmurray.net/test_sites/cans/news.php" rel="noreferrer">http://marcmurray.net/test_sites/cans/news.php</a></p>
  
  <p>I've been trying to load a message confirmation modal for a while after the user submits an email, but can't get it to work at all.</p>
  
  <p>So far I've tried echoing the whole script out, triggering the script, and changing the hash in the URL and checking for that, which has worked in other areas of the site.</p>
  
  <p>Adding functions like alerts and echoing text onto the page is working fine, but when I use the show method it doesn't work. That leads me to believe I am either escaping characters wrong, or misunderstand how modals work a little.
  Can anyone see where I'm messing up?</p>
  
  <p><strong>PHP:</strong></p>
  
  <pre><code>&lt;?php
  if(isset($_POST["submit"])) {
          // Checking For Blank Fields..
      if($_POST["vname"]==""||$_POST["vemail"]==""||$_POST["sub"]==""||$_POST["msg"]==""){
         echo "Please fill out everything! We need to know who you are, and why you want to get in touch with us!";}
      else
          {
          // Check if the "Sender's Email" input field is filled out
          $email=$_POST['vemail'];
                  // Sanitize E-mail Address
          $email =filter_var($email, FILTER_SANITIZE_EMAIL);
                  // Validate E-mail Address
          $email= filter_var($email, FILTER_VALIDATE_EMAIL);
          $emailConfirmed=$_POST['vemail'];
          if (!$email){
            echo "Don't forget to include your email adress! Otherwise we can't get back to you.";
                  }
                  else
                  {
                      $subject = $_POST['sub'];
                      $message = $_POST['msg'];
                      $headers =  'From:' . $emailConfirmed . "\r\n"; // Sender's Email
                      $headers .= 'Cc:' . $emailConfirmed . "\r\n"; // Carbon copy to Sender
                      // Message lines should not exceed 70 characters (PHP rule), so wrap it
                      $message = wordwrap($message, 70);
                      // Send Mail By PHP Mail Function
                      mail("marc.murray.92@gmail.com", $subject, $message, $headers);
                      echo "&lt;script&gt;$('#thankyouModal').modal('show')&lt;/script&gt;";
                  };
      }
   }
  ?&gt;
  </code></pre>
  
  <p><strong>HTML for the modal</strong></p>
  
  <pre><code>&lt;div class="modal fade" id="thankyouModal" tabindex="-1" role="dialog"&gt;
    &lt;div class="modal-dialog"&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-header"&gt;
            &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
            &lt;h4 class="modal-title" id="myModalLabel"&gt;Thank you for pre-registering!&lt;/h4&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
            &lt;p&gt;Thanks for getting in touch!&lt;/p&gt;                     
        &lt;/div&gt;    
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>EDIT: Updated code to be simpler than initial question.</p>