axios.post('/ajax/data.php', {test: 'test'})
.then((response) => {
let data = response['data'];
console.log(data);
})
.catch((error) => {
console.log('error', error);
});
echo 'post= ' . json_encode($_POST);
const bodyFormData = new FormData();
bodyFormData.set('data', JSON.stringify({
url: this.url,
test: 'test'
}));
axios({
method: 'post',
url: '/ajax/data.php',
data: bodyFormData,
})
axios.post(
'/ajax/data.php',
'data=' + JSON.stringify({
url: this.url,
test: 'test'
})
)
$data = json_decode( html_entity_decode( stripslashes ($_POST['data']) ) );
echo json_encode($data);