我想在 Laravel 中做到這一點:https ://laravel.com/docs/5.6/redirects我有一個簡單的按鈕,一個命名路由,我希望路由重定向到另一個頁面。雖然我在 Chrome 的網絡控制臺中看到了新頁面,但頁面本身實際上并沒有重定向。(我不想在 javascript 函數中使用 window.location.href,因為我希望該路線完成這項工作。)layout.blade.php $("#myRedirectButton").click(function(){ $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }); $.ajax({ method: 'post', dataType: 'text', url: 'redirect-testing-link', success: function (data) { } }); });路線/ web.phpRoute::post('/redirect-testing-link', function () { return redirect()->route('gidis');});Route::get('/gosterge_paneli', function () { return view('gosterge_paneli');})->name('gidis');
盡管我在控制臺中看到了新頁面,但 laravel jquery ajax 并未重定向
幕布斯6054654
2021-06-30 18:47:24