0

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

1 Answer 1

1

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 => ....);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.