0👍
You must return json header from backend:
header('Content-Type: application/json');
echo json_encode($data);
And accept json in front end:
axios.post("/", {
headers: {
'Content-Type': 'application/json'
},
data
})
Source:stackexchange.com