I am a novice at jquery/javascript. I am trying to use validate plugin and then make a ajax request with post() and I am thoroughly confused by the submitHandler option
Here's what I have: The html ------------ <form id="mail_form" name="mail_form" method="post" action="xxx.php" > // many form elements here using validate plugin <input class="submit" type="submit" id="mail_button" value="Submit" / > </form> // where xxx.php is NOT what I want to have executed because I don't want a page refresh. The jquery stuff --------------------- $(document).ready(function(){ $('#mail_form').validate(); $('#mail_form').submit(function() { var formData = $('#mail_form').serialize(); $.post('mailer.php',formData,processResponse); function processResponse(data,status) { if(status='success') { $('#zone1').html(data); } else { $('#zone1').html('<p class="message_text">An error has occured.</ p>'); } } }); I want to execute mailer.php. I understand I should use the submitHandler: but I have no idea how to do it and retain the usage of serialize and post(). The documentation for this case says: $(".selector").validate({ submitHandler: function(form) { $(form).ajaxSubmit(); } }) but looking at the docs for ajaxSubmit seems to get orders of magnitude more complicated. Suggestions? Thanks. Mike