I am trying to POST some data from Vue.js to a backend based on Symfony using the following code.
updateQuestion : function() {
axios.post('/staff/question/api/' + this.id,{
id : 'test',
name : 'sree'
})
.then( response => {
console.log(response);
})
.catch(error => {
console.log(error);
})
},
However, the parameters that I am attaching to the POST request are not reaching my controller. So, I tried the alternate format for POST requests and still, the parameters are not reaching the controller. Please tell me what's wrong.
Alternate format:
updateQuestion : function() {
axios({
method : 'POST',
url : '/staff/question/api/' + this.id,
data: {
id : 'test',
name : 'sree'
}
})
.then( response => {
console.log(response);
})
.catch(error => {
console.log(error);
})
},