NoroffFEU / musikkforandrerliv.no

The Unlicense
8 stars 3 forks source link

add function to switch the language (#479) #481

Closed ukonuidika closed 1 month ago

ukonuidika commented 1 month ago

(1) Firstly I have created a JS file for the contact form.

(2) I also created a html file for this purpose as well.

(3) I also created a php file to help send the mail to the saver.

Below is my JS for Contact form.

document.addEventListener( "DOMContentLoaded", function () { var contactForm = document.getElementById ("contact-form"); var formMessages = document.getElementById ("form-messages"); contactForm.addEventListener("submit", function (event){ event.preventDefault(); var formData = new formData(contactForm); fetch("contact.php",{ method: "POST", body: formData })

        .then(function(response) {
            return response.json();
        })

        .then(function(data) {
            formMessages.textContent = data.message;
            formMessages.style.display = "block";
            if (data.success) {
                formMessages.style.color = "green";
                contactForm.reset();
            }
            else {
                formMessages.style.color = "red";
            }
        })

        .catch(function(error) {
            console.error("Error", error);
        });

    });

});
netlify[bot] commented 1 month ago

Deploy Preview for snazzy-moonbeam-86e465 ready!

Name Link
Latest commit 9367578e6f2fe2f26b1bb73f9e64951d9f74071f
Latest deploy log https://app.netlify.com/sites/snazzy-moonbeam-86e465/deploys/661b06de966317000882a0ce
Deploy Preview https://deploy-preview-481--snazzy-moonbeam-86e465.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] commented 1 month ago

Deploy Preview for dazzling-melomakarona-fe8d9f ready!

Name Link
Latest commit 9367578e6f2fe2f26b1bb73f9e64951d9f74071f
Latest deploy log https://app.netlify.com/sites/dazzling-melomakarona-fe8d9f/deploys/661b06deffae3500088914cc
Deploy Preview https://deploy-preview-481--dazzling-melomakarona-fe8d9f.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.