mcallaro88 Posted October 25, 2009 Share Posted October 25, 2009 I have a php page and I'm using jQuery and some AJAX to validate my contact form (phpmailer & process.php). However, the message is never displayed in my email. The name, email, and subject get passed but the message always comes back as Message: [object HTMLTextAreaElement]. Now it comes back as undefined. I don't know whats wrong. Thanks for all who help - MIKE Here is the code =============================================================== $(function() { $('.error').hide(); $('input.text-input').css({backgroundColor:"#FFFFFF"}); $('input.text-input').focus(function(){ $(this).css({backgroundColor:"#FFFFFF"}); }); $(".button").click(function() { // validate and process form // first hide any error messages $('.error').hide(); var name = $("input#fName").val(); if (name == "") { $("label#fName_error").show(); $("input#fName").focus(); return false; } var email = $("input#email").val(); if (email == "") { $("label#email_error").show(); $("input#email").focus(); return false; } var subject = $("input#subj").val(); if (subject == "") { $("label#subj_error").show(); $("input#subj").focus(); return false; } var message = $("input#memo").val(); if (message == "") { $("input#memo").focus(); return false; } var dataString = 'fName='+ name + '&email=' + email + '&subj=' + subject + '&memo=' + message; //alert (dataString);return false; $.ajax({ type: "POST", url: "bin/process.php", data: dataString, success: function() { $('.formContainer').html("<div id='message'></div>"); $('#message').html("<h2>Contact Form Submitted!</h2>") .append("<p>I will be in touch soon.</p>") .hide() .fadeIn(1500, function() { $('#message').append("<img id='checkmark' src='images/check.png' />"); }); } }); return false; }); }); runOnLoad(function(){ $("input#fName").select().focus(); }); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.