title: Bootstrap modal email form
body: <p>I've searched for an answer but could not find any. Maybe someone here can point me to the right direction.</p>
  
  <p>I have a simple modal form (bootstrap). It's meant to work like this.</p>
  
  <p>You enter the form and click Send. The form-info is sent to e-mailadress. When mail is sent new modal with confirmation is displayed. </p>
  
  <p>I've tried to implement this solution: <a href="https://gist.github.com/jbatista19/4972740" rel="nofollow">Bootstrap Modal ajaxified</a></p>
  
  <p>So far i have this:
  The modal:</p>
  
  <pre><code>&lt;div class="hide fade modal" id="input-modal"&gt;
  &lt;form class="form-horizontal well" data-async data-target="#input-modal" action="/some-endpoint" method="POST"&gt;
      &lt;fieldset&gt;
          &lt;div class="modal-header"&gt;
              &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;×&lt;/button&gt;
              &lt;h3 id="myModalLabel"&gt;Modal header&lt;/h3&gt;
          &lt;/div&gt;
          &lt;div class="modal-body"&gt;
              &lt;label&gt;Name&lt;/label&gt;
              &lt;input id="name" type="text" placeholder="Type your name..."&gt;
          &lt;/div&gt;
          &lt;div class="modal-footer"&gt;
              &lt;a href="#" class="btn" data-dismiss="modal"&gt;Cancel&lt;/a&gt;
              &lt;button type="submit" class="btn btn-primary" value="send"/&gt;Send&lt;/button&gt;
          &lt;/div&gt;
      &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p></p>
  
  <p>The Javascript:</p>
  
  <pre><code>jQuery(function($) {
  $('body').on('submit','form[data-async]', function(event) {
      alert('submit Event');
      var $form = $(this);
      var $target = $($form.attr('data-target'));
  
      $.ajax({
          type: $form.attr('method'),
          url: $form.attr('action'),
          data: $form.serialize(),
          success: function(data, status) {
          $target.html(data);
          }
      });
      event.preventDefault();
  });
  </code></pre>
  
  <p>});</p>
  
  <p>But I need help with sending the input by mail and also sent info back to modal as a confirmation.</p>
  
  <p>I've tried to solve this by myself for several days now, but now I've given up. </p>