Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 13, 2024

Conversation

ukonuidika
Copy link

(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);
        });

    });
    
});

@ukonuidika ukonuidika requested a review from a team April 13, 2024 22:27
Copy link

netlify bot commented Apr 13, 2024

Deploy Preview for snazzy-moonbeam-86e465 ready!

Name Link
🔨 Latest commit 9367578
🔍 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.

Copy link

netlify bot commented Apr 13, 2024

Deploy Preview for dazzling-melomakarona-fe8d9f ready!

Name Link
🔨 Latest commit 9367578
🔍 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.

@ukonuidika ukonuidika merged commit 30fb405 into 180-contact-form-js-file Apr 13, 2024
10 checks passed
@ukonuidika ukonuidika self-assigned this Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants