Submit Form With Ajax And Jquery Validation March 05, 2023 Post a Comment I have form. There are two inputs:name and birthday. My code is: Solution 1: Try using the below code instead of ajaxSubmit: $.ajax({ type: "GET", url: "addEmpl.php", data: $(this).serialize(), dataType: "html" success: function(data) { $("#block").html(data); } }); Copy Hope it will help you :) Solution 2: You can write like this: $().ready(function() { $("#addForm").validate({ rules:{ name:{ required: true, minlength: 2, maxlength: 10, }, }, highlight: function (element) { $(element).closest('.form-group').addClass('has-error'); }, messages:{ name:{ required: "This field is required", minlength: "Name must be at least 2 characters", maxlength: "Maximum number of characters - 10", }, }, submitHandler: function(form) { $.ajax({ url:'addEmpl.php', type:'GET', dataType: 'html', success: function(data) { $("#block").html(data); } }); return false; // required to block normal submit since you used ajax } }); }); Copy Here is the fiddle http://jsfiddle.net/bhumi/bvdu94c4/Baca JugaCan Not Download Html With PhantomjsLatency / Ping Test From BrowserHow To Autosubmit Data Html Form? Solution 3: You can try this <script> $('#submit').click(function (){ //your code here }); </script> Copy Share You may like these postsModal Pop Up Fade In On Open Click And Fade Out On CloseHow To Read Input Two Dimensional Array Value In Jquery?Detect If Checkbox Is Checked Or Unchecked In Angular.js Ng-change EventHow To Destroy A Datatable? Post a Comment for "Submit Form With Ajax And Jquery Validation"
Post a Comment for "Submit Form With Ajax And Jquery Validation"