Submit Form With Ajax And Jquery Validation June 11, 2024 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); } }); CopyHope 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); } }); returnfalse; // required to block normal submit since you used ajax } }); }); CopyHere is the fiddle http://jsfiddle.net/bhumi/bvdu94c4/Baca JugaJquery/js/php - Disable Form And Submit Button Only After SubmitHow To Prepopulate A Dialog In Angularjs/bootstrapI Have A Row From A Html Table In The Form : $(row).text(). How Do I Feed This Into A Input Type="hidden" ElementSolution 3: You can try this <script> $('#submit').click(function (){ //your code here }); </script>Copy Share You may like these postsJquery Select Box And Loop HelpHow To Replace Whitespace With Underscore When Copy Value From Form Field To AnotherJavascript Encode Field Without Spoiling The DisplayPrevent Form Submit But Retain Form Validation Post a Comment for "Submit Form With Ajax And Jquery Validation"
Post a Comment for "Submit Form With Ajax And Jquery Validation"