Return to Snippet

Revision: 37594
at December 13, 2010 11:19 by creativeboulder


Initial Code
$("#sendmessage").click(function() {
        var name = $("input#name").val();
        var email = $("input#email").val();
        var comments = $("textarea#comments").val();
        var dataString = 'Name=' + name + '&Email=' + email + '&Comment=' + comments;
        $.ajax({
            type: "POST",
            url: "lib/form2mail/form2mail.php",
            data: dataString
        });

Initial URL


Initial Description
This is some very basic jQuery to post from a comment form on a website. I would probably change the .click to .bind("click",) and for different sites I add a success message. This code works with a basic form with text inputs named #name and #email and a textarea named #comments.

Very basic.

Initial Title
jQuery and Form2Mail

Initial Tags
form, javascript, post, jquery

Initial Language
jQuery