GodziLaravel
1 week ago

How to post and receive a Javascript array ?

Posted 1 week ago by GodziLaravel

Hello ,

I have a JS array that I would like to post it to stopController (store method).

[
{"id":317,"long":"-1.9663780","lat":"34.6561680","official_name":"Florence Hill","name":"Jessika Common","terminus":0,"created_at":"2020-05-10T14:11:29.000000Z","updated_at":"2020-05-10T14:11:29.000000Z","line_id":104,"order":null},

{"id":1151,"long":"-1.9669780","lat":"34.6541680","official_name":"Florence Hill - 1","name":"Jessika Common -1","terminus":0,"created_at":"2020-05-10T14:11:29.000000Z","updated_at":"2020-05-10T14:11:29.000000Z","line_id":104,"order":null},

{"id":1152,"long":"-1.9666780","lat":"34.6531680","official_name":"Florence Hill - 2","name":"Jessika Common -2","terminus":0,"created_at":"2020-05-10T14:11:29.000000Z","updated_at":"2020-05-10T14:11:29.000000Z","line_id":104,"order":null}

]

to post this values :

deleteStop(){
                this.$store.dispatch('saveStops',{stops:this.stops}).then(
                    response=>{
                        console.log(response.data)
                    }
                )
            },

I'm wondering , how to save() this array of objects in the store method in stopController ?

Please sign in or create an account to participate in this conversation.