diff --git a/index.html b/index.html index 32a607e..8a37f08 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@ diff --git a/src/js/email.js b/src/js/animesEmailSender.js similarity index 96% rename from src/js/email.js rename to src/js/animesEmailSender.js index a8122f2..eaa45a3 100644 --- a/src/js/email.js +++ b/src/js/animesEmailSender.js @@ -10,7 +10,7 @@ button.addEventListener("click", (e) => { emailjs .send( "service_l0s9372", - "template_n3aufxj", + "template_1imfn8o", { name: name.value, email: email.value }, "Xts0UwNohpeU1f3pZ" ) diff --git a/src/js/gamesEmailSender.js b/src/js/gamesEmailSender.js new file mode 100644 index 0000000..32dc653 --- /dev/null +++ b/src/js/gamesEmailSender.js @@ -0,0 +1,37 @@ +const button = document.querySelector('button[value="SEND"]'); + +button.addEventListener("click", (e) => { + e.preventDefault(); + + const name = document.getElementById("name"); + const email = document.getElementById("email"); + + if (name.value && email.value) { + emailjs + .send( + "service_l0s9372", + "template_n3aufxj", + { name: name.value, email: email.value }, + "Xts0UwNohpeU1f3pZ" + ) + .then( + function () { + console.log("SUCCESS!"); + }, + function (error) { + console.log("FAILED...", error); + } + ); + name.value = ""; + email.value = ""; + + const form = document.querySelector("form"); + if (document.querySelector(".thanks")) { + document.querySelector(".thanks").remove(); + } + form.insertAdjacentHTML( + "afterend", + '
Thank you for subscribing to our newsletter!
' + ); + } +}); diff --git a/src/pages/animes/animes.html b/src/pages/animes/animes.html index 1d09cd7..84af479 100644 --- a/src/pages/animes/animes.html +++ b/src/pages/animes/animes.html @@ -79,7 +79,7 @@