This question already has an answer here:
- Axios posting params not read by $_POST 3 answers
I want to send a POST request to a PHP script. I am using Axios:
axios.post('inc/vote.php', {
id: this.selected,
}) .then(function (response) {
console.log(response);
});
In the PHP file I am trying something like this to retrieve that id variable from axios:
$id = $_POST['id'];
But seems it is not doing anything.
What is the correct way to retrieve variables from the request?
</div>