Reputation: 33
for now i have method:
let newFormData = {
productName: this.productName,
productModel: this.productModel,
prodDescription: this.prodDescription,
prodPrice: this.prodPrice,
promoPrice: this.promoPrice
};
console.log(newFormData);
e.target.reset();
},
and i want to send this form data to file, and save it as a variable in json
Upvotes: 0
Views: 34
Reputation: 717
at first you should have a route to submit this form data to, then you can submit the form like this:
axios.post('http://localhost:3030/api/new/post',
this.productName,
this.productModel,
this.prodDescription,
this.prodPrice,
{ headers: {
'Content-type': 'application/x-www-form-urlencoded',
}
}).then(response => ....);
Upvotes: 1