dwyl / learn-to-send-email-via-google-script-html-no-server

:email: An Example of using an HTML form (e.g: "Contact Us" on a website) to send Email without a Backend Server (using a Google Script) perfect for static websites that need to collect data.
GNU General Public License v2.0
3.15k stars 910 forks source link

Redirecting? #421

Open eetuhal opened 2 years ago

eetuhal commented 2 years ago

After submitting the form I got {"result":"success","data":"{\"msg\":[\"\"],\"name\":[\"\"],\"email\":[\"\"]}"}. How do I redirect to the original page with url?

eetuhal commented 2 years ago

Hi,

It is not working...

What return statement you mean specifically?

Thank a lot

su 23. tammik. 2022 klo 11.04 Aditya Ajmera @.***) kirjoitti:

For redirecting, I used: return HtmlService.createHtmlOutput( "" );

in place of the earlier return statement.

(From StackOverflow)

— Reply to this email directly, view it on GitHub https://github.com/dwyl/learn-to-send-email-via-google-script-html-no-server/issues/421#issuecomment-1019442258, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKGQZEWKAEJELW5YQGM7Q6DUXPABHANCNFSM5LUCPN7A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: <dwyl/learn-to-send-email-via-google-script-html-no-server/issues/421/1019442258 @github.com>

bledatunay commented 2 years ago

https://github.com/dwyl/learn-to-send-email-via-google-script-html-no-server#part-two---make-it-look-good-

AidanTheBandit commented 2 years ago

After following those steps I cant seem to make it no redirect

bledatunay commented 2 years ago

Download the repo, open up test.html and submit a form. If that works, you are indeed missing something in your project. If that is not working as well, it should be related to your browser / extensions (some ad-blocker filters are known to block ajax calls).

Note that, what README.md explains and what ajax does has nothing to do with redirecting per se - json is not somehow redirected to the main page, instead, we are not leaving the page in the first place by using ajax. So you might want to reconsider what you're trying to accomplish.