My ajax (in vue component) like this :
<template>
...
<a class="text-right" @click="detail">
Detail
</a>
...
</template>
<script>
export default{
...
methods:{
...
detail() {
this.$http.post(window.BaseUrl + '/shop/',{data: JSON.stringify(this.data)}).then(function (response) {
...
}).catch(function(error){
...
});
}
}
}
</script>
If user click a link, it will call detail method
In detail method used to send data via ajax
It will routes in laravel
The route like this :
Route::group(['prefix' => 'shop','as'=>'shop.'], function () {
Route::post('/', 'ShopController@index');
...
});
Then the route will call shop controller
The controller like this :
public function index(Request $request)
{
$param = $request->only('data');
$list = $this->shop_service->getList($param['cart_cache']);
return view('shop.index',compact('list'));
}
If the code executed, I want it will redirect to view blade laravel (return view('shop.index',compact('list'));
)
How can I do it?