[Vuejs]-Undefined error in Laravel URL (404 not found)

0👍

this problem can be raise for CROS.
the request need some headers for allow accessing cross-origin,
for solving the issue change your request as below:

var url = "/oneminuteusers";
data = {
    buscar: buscar
    criterio: criterio
}
header = {
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Headers": "X-CSRF-TOKEN, Origin, X-Requested-With, Content-Type, Accept, Access-Control-Allow-Origin"
}

axios.get(url, data, header)
        .then(function(response) {
          var respuesta = response.data;
          me.usersArray = respuesta.users.data;
          me.totalUsers = respuesta.totalusers;
          console.log(me.totalUsers);
          console.log(response.data);
        })
        .catch(function(error) {
          console.log(error);
        });

`

Leave a comment