首页 > 解决方案 > 使用 Ajax 中的语句重定向路由

问题描述

在我的方法中,我有以下路线声明

return redirect('home')->with('success', 'Request is send!');

现在,我想在我的 ajax 成功函数中有这个。目前我正在使用它并且我正确地重定向到“家”,但我的成功消息没有运行。

$.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!')); 
                    }

我必须改变什么?

标签: ajaxlaravelroutes

解决方案


推荐阅读