问题描述
这是我第一次开发东西,所以第一次使用laravel。 现在,我发出了flash_error消息,我希望这些消息在3秒后关闭。不知道该怎么做。
这是我随后在控制器中编写的方式:
return redirect('/admin/settings')->with('flash_message_error','Incorrect Current Password!');
@if(Session::has('flash_message_error'))
<div class="alert alert-error alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>{!! session('flash_message_error') !!}</strong>
</div>
@endif
解决方法
像这样使用Jquery
$("document").ready(function(){
setTimeout(function(){
$("div.alert").remove();
},3000 ); // 3 secs
});