/ Published in: jQuery

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.
Very basic.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$("#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 });
Comments
