Answer the question
In order to leave comments, you need to log in
Why Cannot POST when sending data via axios?
I want to send data from the form to the server
formSubmit: function () {
let resultData = JSON.stringify(this.formData)
axios.post('https://Домен/api/tasks/create.php', {
data: resultData
})
.then(response=>{
console.log(response);
})
.catch(error=>{
console.log(error);
})
}
formData: {
name: "Alex",
geo: "Ru",
executor: "1",
complexity: "1",
deadline: "2022-03-07 12:20:22",
},
formSubmit: function () {
let resultData = JSON.stringify(this.formData)
axios({
method: 'post',
url: 'https://домен/api/tasks/create.php',
data: resultData,
headers: {
"Content-type": "application/json"
}
})
.then(function(response) {
console.log('Ответ сервера успешно получен!');
console.log(response.data);
})
.catch(function(error) {
console.log(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