虽然我在控制台中看到了新页面,但是laravel jquery ajax没有重定向

I want to do this in laravel: https://laravel.com/docs/5.6/redirects

I have a simple button, a named route, and I want the route to redirect to another page.

Although I see the new page in the network console of Chrome, the page itself is not actually redirecting.

(I don't want to use the window.location.href in the javascript function as I want the route to do the job.)

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)
            {

            }
        });

    });

routes/web.php

Route::post('/redirect-testing-link', function () {
    return redirect()->route('gidis');
});


Route::get('/gosterge_paneli', function () {
    return view('gosterge_paneli');
})->name('gidis');

You can't do a serverside redirect after an AJAX request, so what you ask is very hard.

The simplest ways to solve it are by using either the window.location you wanted to avoid, or skip the whole AJAX call and use an <a> element.