[Vuejs]-How to redirect to specific page

2👍

Instead of using return redirect()->route('cotizacion-enviada', [$id]);, you can do
response()->json(["redirect" => route('cotizacion-enviada', [$id])]);

Then on your Vue app, check if your response has the key named redirect by using obj.hasOwnProperty("redirect"). And within the condition body, you may redirect to the route which you are sending from the controller method as well.

1👍

If you need id in ‘cotizacion-enviada’ try this:

Route::get('cotizacion-enviada/{id}', function ($id) {
     return view('quotationshippingvalid', ['id' => $id]);
})->name('cotizacion-enviada');

If your route only render view file, you can render view inside your controller directly.

Leave a comment