title: bootstrap modal close after 4 seconds or user click
body: <p>How would I set a timeout for a bootstrap modal? After getting the ajax data back that the message returned by php contains the term <code>success</code>, I want to give the user the option to close the window. However, I also just want to have a 4 second count down. Currently the second the success message comes back the modal hides itself.</p>
  
  <pre><code>$('#forgotform').submit(function (e) {
      "use strict";
      e.preventDefault();
      $('#forgotsubmit').button('loading');
      var post = $('#forgotform').serialize();
      var action = $('#forgotform').attr('action');
      $("#message").slideUp(350, function () {
          $('#message').hide();
          $.post(action, post, function (data) {
              $('#message').html(data);
              document.getElementById('message').innerHTML = data;
              $('#message').slideDown('slow');
              $('#usernamemail').focus();
              if (data.match('success') !== null) {
                  $('#forgotform').slideUp('slow');
                  $('#forgotsubmit').button('complete');
                  $('#forgotsubmit').click(function (eb) {
                      eb.preventDefault();
                      $('#forgot-form').modal('hide');
                  });
                  setTimeout($('#forgot-form').modal('hide'), 10000);
              } else {
                  $('#forgotsubmit').button('reset');
              }
          });
      });
  });
  </code></pre>