Comments (4)
Glad to hear it has worked ok so far! See this Q&A, may have to debug what's going on with your form since likely it's using native browser form submission. There's probably a way to tie this in to a button click triggered from react to submit the form. Just make sure to stop the click before the browser default behavior runs.
Why is the webpage forwarding to a bunch of text when I hit submit?
You are not properly loading the required Javascript which submits the data via AJAX, or your browser does not support AJAX. Please see Part 2 and check your console logs in case you are finding errors.
from learn-to-send-email-via-google-script-html-no-server.
Just a remark/question! The native fetch
does the job, so why do you want to bring in another dependency?
from learn-to-send-email-via-google-script-html-no-server.
Fixed!
The problem was exactly what @mckennapsean had said: the default behaviour of the browser (full page reload) was not what I was looking for.
I wrote a function that prevents the default behaviour and makes a call using the Axios library (native fetch API also works). I then called it on the <form/>
's onSubmit={}
attribute.
See my PR if you're looking to do this with a React element!
from learn-to-send-email-via-google-script-html-no-server.
Just a remark/question! The native
fetch
does the job, so why do you want to bring in another dependency?
I use Axios for all of my API calls, so it was just easier to stick with the same syntax. Take a look of this sample I wrote that uses native fetch API if you're looking for an example:
from learn-to-send-email-via-google-script-html-no-server.
Related Issues (20)
- Concatenating Name and String to make a custom subject for each email. HOT 12
- Help with customizing the email sent HOT 1
- Redirecting? HOT 4
- Can You please provide video.
- Adding new entries to the top of google sheet HOT 3
- send email via google script html
- ajax post works on pc but doesnt on mobile phones? HOT 1
- Checkbox input fields issue HOT 1
- Hide hidden input fields in email HOT 3
- update & fix readme links
- update links
- update researching recommendations on user privacy link HOT 1
- Thank You message doesn't disply HOT 1
- Receive Pictures and Documents HOT 4
- Mail is no longer delivered HOT 7
- {"result":"error","error":{"message":"\"TO_ADDRESS\" is not defined.","name":"ReferenceError","fileName":"script","lineNumber":56,"stack":"\tat script:56 (doPost)\n"}} HOT 2
- reload upon submission HOT 2
- It only works on PC, Windows, and Android. HOT 5
- File input
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from learn-to-send-email-via-google-script-html-no-server.