Ajax中带语句的重定向路由
在我的methode中,我有下面的路由语句Ajax中带语句的重定向路由,ajax,laravel,routes,Ajax,Laravel,Routes,在我的methode中,我有下面的路由语句 return redirect('home')->with('success', 'Request is send!'); 现在,我想在我的ajax成功函数中包含这一点。目前我正在使用它,我正确地重定向到“主页”,但我的with success消息没有运行 $.ajax({ headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('conte
return redirect('home')->with('success', 'Request is send!');
现在,我想在我的ajax成功函数中包含这一点。目前我正在使用它,我正确地重定向到“主页”,但我的with success消息没有运行
$.ajax({
headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
type: 'post',
url: '/home/grouprequest',
data: {'groupid': groupid},
success: function (result) {
window.location.replace('/home'->with('success', 'Request is send!'));
}
我必须更改的内容?能否添加
grouprequest
操作代码?'/home'->带有('success','Request is send!')
-代码不正确window.location.replace
-js函数。尝试通过html表单发送帖子。尝试以下操作:location.reload(true);而不是window.location.replace