I need to make a request through axios, in which I want to pass as an array an array of this type [1,2,3,4]
. I need this data to make a selection query from my backend, my question is: should I use a GET
or POST
request and what would be the correct way to pass this array?
You can POST
it as json data
let data=[1,2,3,4,5];
let json=JSON.stringify(data);
let post_data={json_data:json}
axios.post('/url',post_data)
JSON.stringify
to convert it to json stringOn laravel side you can do like below
$jsonArray = json_decode($response,true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With