title: Hide modal on form submit
body: <p>I have the following function in my website to submit a form thats in a modal. All works fine except when i uncomment that commented line, when I uncomment that line my test mysql insert on page /index.php/trainings/add isn't executed. I'm new to javascript and ajax so I fear I'm missing something stupid. The modal div I want to close is called id="addModal", it tried simply $(div#addModal).hide(); but this only hides the div and leaves the black "matt" background over the webpage.</p>
  
  <pre><code>$(function() {  
    $("button#submit_button").click(function() {  
      var date = $("input#date").val();  
      var dataString = 'date='+ date;
      $.ajax({  
          type: "POST",  
          url: "/index.php/trainings/add",  
          data: dataString,  
          success: function() {  
              //$(div#addModal).modal.hide();
          }  
      });
      return false;
    });  
  });    
  </code></pre>
  
  <p>would be very gratefull if someone could help.</p>
  
  <p>Thanks,
  James</p>
  
  <p>EDIT:</p>
  
  <p>Don't know if this could be of any use but this is my modal with the form in it:</p>
  
  <pre><code>&lt;div id="addModal" class="modal hide faid" area-hidden="true"&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;h3&gt;Add Training&lt;/h3&gt;
  &lt;/div&gt;
  &lt;form class="form-horizontal" id="addform"&gt;
      &lt;div class="control-group"&gt;
      &lt;label class="control-label"&gt;Date&lt;/label&gt;
              &lt;div id="datetimepicker1" class="input-append date"&gt;
          &lt;input data-format="dd/MM/yyyy hh:mm:ss" type="text" id="date"&gt;&lt;/input&gt;
          &lt;span class="add-on"&gt;
          &lt;i data-time-icon="icon-time" data-date-icon="icon-calendar"&gt;&lt;/i&gt;
          &lt;/span&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="modal-footer"&gt;
      &lt;button class="btn" data-dismiss="modal" aria-hidden="true"&gt;Close&lt;/button&gt;
      &lt;button type="submit" id="submit_button" class="btn btn-primary"&gt;Save changes&lt;/button&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  &lt;/div&gt;  
  </code></pre>