I am trying to send data with Axios:
axios.post( url,JSON.stringify({'i': '90'}))
.then(function (response) {
console.log(response);
});
And get it on the server:
var_dump(($this->input->post())); // Returns an array | $_POST
For the above JSON value, I am getting this response:
array(2) { ["{"i":"90"}"]=> string(0) "" [0]=> string(0) "" }
Without JSON.stringify
, the result from var_dump(($this->input->post()));
or with $_POST
is empty array.
How to send POST
request with JSON data with Axios and get it on the server with PHP?