php - JQuery Validator - Success function not being called on valid submission -


i using jquery validator from: http://bassistance.de/jquery-plugins/jquery-plugin-validation/

i have written jquery need validates correctly last part of submit function not working correctly.

$("#commentform").validate({     rules: {         email_options_name: {             required: true         },         email_options_company: {             required: true         },         email_options_country: {             required: true         },         email_option_email: {             required: true,             email: true         },         check_options: {             required: true,             minlength: 1         }     },       });  $("#commentform").submit(function(){      var valid = $("#commentform").valid();     if (valid) {                 $.post('scripts/process_email_initial_form.php',$(this).serialize(), function(o) {                     location.reload();                 }, 'json');             } else {                 $('.full-error').show();             }                  return false; });  $.extend($.validator.messages, {             required: "!",             email: "!" }); 

}

when submit valid script process_email_initial_form.php called , processes correctly (from looking firebug) , if not div show. problem when script has finished running location.reload(); not call. ideally wanted direct success page didn't work either.

i tried put php header function @ end of process_email_initial_form.php not work either.

any appreciated.

as per docs, submithandler callback 'the right place submit form via ajax after validated.'

$("#commentform").validate({     rules: {         // rules here     },     submithandler: function(form) {        // example below uses 'form' plugin        // http://www.malsup.com/jquery/form/#api        $(form).ajaxsubmit({             success: function(){                 window.location.href="newpage.php"             }        });     }       }); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -