How to send data from laravel controller with a custom array to vuejs

Hi I send the axios with custom data like this one: axios.post(‘/api/hr_employee/days/’+ this.period_data.year +’/’+ this.period_data.month … Read more How to send data from laravel controller with a custom array to vuejs

Hi I send the axios with custom data like this one:

axios.post('/api/hr_employee/days/'+ this.period_data.year +'/'+ this.period_data.month +'?page='+this.currentPage+'&api_token='+App.apiToken)
                .then(response => {
           
    console.log(response.data.rut);
});

It displays this:

code: 200
data: "{"rut":["06152617-K"],"full_name":[""],"total_days":[30]}"
msg: ""

My controller code is this one:

BUT when I do this:

console.log(response.data.rut); 

It says that it’s undefined but how you can see it is not undefined it should display 06152617-K so I wonder what I am doing wrong? if it comes with a value

Thanks.

Source: Vue – Stack Overflow


Categories: NewsTags: ,

Tags: ,


Leave a Reply

Your email address will not be published. Required fields are marked *