A
A
Alex Polyakh2017-09-13 13:09:02
JavaScript
Alex Polyakh, 2017-09-13 13:09:02

The 'axios' library, having carefully studied api, did not manage to write data to the request body (body) how to do this correctly?

Chrome browser (pos. version)
this method does not work:
var params = new URLSearchParams();
params.append('param1', 'value1');
params.append('param2', 'value2');
axios.post('/foo', params);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Shashenkov, 2017-09-13
@PolyakhAleksandr

var params = new FormData();
params.append('param1', 'value1');
params.append('param2', 'value2');
axios.post('/foo', params);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question