Как установить действие публикации в запросе публикации Axios? В JQuery я делаю это так:
jQuery.post(ajax_object.ajax_url,
{
'action': 'add_foobar',
'data': 'foobarid'
},
function(response){
alert('The server responded: ' + response);
}
);
Это не работает для axios ...
axios.post(ajax_object.ajax_url, {
action: 'add_foobar',
data: {
foobarid: 'foobarid'
}
})
.then(response => {
alert('Message successfully sent')
})
.catch(e => {
alert('Failed to send message' + e.message)
})
Я получаю 400
ошибку обратно. Есть идеи как установить пост action
?