Send to thanks page after submit.
Opened this issue · 3 comments
How can i load another url after submit the form, for conversion?
You might want to change the js
form.addEventListener('submit', e => {
e.preventDefault()
fetch(scriptURL, { method: 'POST', body: new FormData(form)})
.then(response => console.log('Success!', response), location = "yourpagehere.com)
.catch(error => console.error('Error!', error.message))
})
yeah I did similar to above my code looks like this, the thanks and error html files are in the same dir as the webform, my syntax is slightly different -
form.addEventListener('submit', e => {
e.preventDefault()
fetch(scriptURL, { method: 'POST', body: new FormData(form)})
.then(response => { console.log('Success!', response); window.location.href="thanks.html";} )
.catch(error => { console.error('Error!', error.message); window.location.href="error.html";} )
})
You might want to change the js
form.addEventListener('submit', e => {
e.preventDefault()
fetch(scriptURL, { method: 'POST', body: new FormData(form)})
.then(response => console.log('Success!', response), location = "yourpagehere.com)
.catch(error => console.error('Error!', error.message))
})
Which file is this in? Is it in the code.gs or on the js for the webpage? Sorry if it's a dumb question, I'm new to this haha