Home » Php » php – axios.get() returns document html, but if i use axios.post() returns the data i want

php – axios.get() returns document html, but if i use axios.post() returns the data i want

Posted by: admin February 25, 2020 Leave a comment

Questions:

Fakultas.Vue

loadFakultas(){
  axios.get('fakultas')
    .then(({data}) => (this.fakultas = data.data));
}

FakultasController

public function index(){
  return ['message' => 'sukses']
}

Route

Route::resources([
  'admin' => 'AdminController',
  'fakultas' => 'FakultasController'
]);

In this case, if I use axios.post('getFakultas') and dan route

Route::post('getFakultas','[email protected]');

I can get the data what I want

How to&Answers: