Is there a way to automatically hide the success message that appears after an AJAX request is successful? For example, after 2 seconds of displaying the message, I want it to disappear.
Here's the code I have:
$.ajax({
url : 'process/register/registerDB.php',
success : function (data, textStatus, jqXHR) {
timer = setTimeout(successNotification, 2000);
}
});
function successNotification {
$('#alert-box')
.html('<div class="alert alert-success" role="alert">User <b>'
+ newUserArr["fullname"]
+ '</b> Successfully Submitted</div>');
}
What could be the issue with my implementation?