Whenever you make an Inertia request you should get an Inertia response (which is JSON). If you need your own JSON data separately from Inertia, then do not make an Inertia request, and do not send an Inertia response
Apr 17, 2021
9
Level 4
How to return json with inertia??
Hi all,
How can I return an API json response with intertia please?
controller
return Inertia::render('Dashboard', [
'data' => $data,
]);
vue
this.$inertia.get('/test-connection', {
preserveScroll: true,
onSuccess: (response) => {
this.TestConnection = response.data;
console.log(response.data);
},
})
I am a bit confused on this.
Thanks
Please or to participate in this conversation.