I’m trying to let the data in a submission form be sent to my email and also added to a google sheet. I found one way of doing it from this link github link. It actually worked for both the purposes I used it for.
My problem is after submitting the form, the page redirects to a json page but I don’t want that to happen. I’ve tried the method they added in the repo but it didn’t work. They mentioned Ajax in the repo but I can’t figure out how to make it work
this is a vue play ground to what I want to do Vue Playground
2
Answers
So to anyone who might be facing the same problem I was facing regarding my page redirecting to a JSON response after submitting a form, Here's what I did
So after the submit button is clicked and the form is sent, a modal pops up to confirm it has been submitted and also the page reloads. The reason for reloading the page is, after submitting the form, it is disabled until a reload happens again.
Add
<form @submit.prevent="submit">
wheresubmit
is your function to post the form’s data with ajax.