I need to remove message after 2 sec but its not working
$.ajax({
'method': 'post',
'url': $form.attr('action'),
'dataType': 'json',
'data': $form.serialize(),
'success': function (res) {
if (res.success) {
$form.find('[type=submit]').removeAttr('disabled');
var h = '<div class="message-success success message"><div>' + res.message + '</div></div>';
$(h).insertBefore($form);
$form.hide();
setTimeout(function () {
$(h).remove();
}, 2000);
}
}});