Answer the question
In order to leave comments, you need to log in
How to send post data json to another domain in vue axios?
Good evening!
I am rewriting one project from jquery to vuejs,
more precisely Yii2 + vuejs
Faced one problem
When transferring json data to another domain (api service), it gives an error:
Request header field X-CSRF-TOKEN is not allowed by Access-Control-Allow-Headers in preflight response.
Code example:
axios.post('http://test.local/api.php?action=order-save', {
data: data
})
.then(response => {
if (response.data.success) {
}
})
.catch(error => {
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question