Git Product home page Git Product logo

Comments (4)

mckennapsean avatar mckennapsean commented on June 14, 2024 3

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.

ndrean avatar ndrean commented on June 14, 2024 2

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.

autumn-lindberg avatar autumn-lindberg commented on June 14, 2024

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.

autumn-lindberg avatar autumn-lindberg commented on June 14, 2024

@ndrean

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:

react-index.zip

from learn-to-send-email-via-google-script-html-no-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.