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 success
, 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.
$('#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');
}
});
});
});
setTimeout
? Does it automatically closes itself? – JofryHS Sep 11 '13 at 3:20