Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.1 kB
2
Indexable
Never
<form id="zoho-form">
    <input type="text" name="name" placeholder="Name">
    <input type="email" name="email" placeholder="Email">
    <textarea name="message" placeholder="Message"></textarea>
    <input type="submit" value="Submit">
</form>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
    // Add a submit event listener to the form
    $("#zoho-form").submit(function(event) {
        event.preventDefault();

        // Create an object to hold the form data
        var data = {};
        data["name"] = $("#zoho-form input[name='name']").val();
        data["email"] = $("#zoho-form input[name='email']").val();
        data["message"] = $("#zoho-form textarea[name='message']").val();

        // Use jQuery's $.ajax method to post the data
        $.ajax({
            type: "POST",
            url: "https://forms.zohopublic.com/your-zoho-form-url",
            data: data,
            success: function() {
                // Do something on success, like display a message
                alert("Form submitted successfully!");
            }
        });
    });
</script>