jquery ajax submithandler function does not work -


somehow code ajax submithandler not work. want have form (myform) being submitted user when jquery validate() validates form correctly.

form validation works ok, submitting form not create proper response , seems reload webpage.

i checked @ http://www.malsup.com/jquery/form/#api , http://jqueryvalidation.org/validate/ cant figure out fault in submit handler code.

please help.

code:

<script>         $(function() {      $("#myform").validate({       rules: {             // simple rule, converted {required:true}               'productname[]': {                 required:true,                 minlength: 2,                 maxlength: 30,             }              }, //rules      // pass options ajaxform        submithandler: function(myform) {         var options = {              type: "post",             url: "form_submit2ajx.php",             data: $("#myform").serialize(),             datatype: "json",              success: function(msg){                 $("#formresponse").removeclass('error');                 $("#formresponse").addclass(msg.statusgeneral);                 $("#formresponse").html(msg.statusgeneral);               },             error: function(){                 $("#formresponse").removeclass('success');                 $("#formresponse").addclass('error');                 $("#formresponse").html("there error submitting form. please try again.");             }      }//var options        $('#myform').ajaxform(options);      $(this).ajaxsubmit();     return false;     }             }); //validate()  }); //function </script> 

just noticed this

        $('#myform').ajaxform(options);         $(this).ajaxsubmit(); 

instead try way

        $(this).ajaxsubmit(options); 

Comments