## jquery.form.js - 表单提交 [github链接](https://github.com/jquery-form/form) [demo](https://jquery-form.github.io) ## demo ``` <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.form/4.2.2/jquery.form.min.js" integrity="sha384-FzT3vTVGXqf7wRfy8k4BiyzvbNfeYjK+frTVqZeNDFl8woCbF0CYG6g2fMEFFo/i" crossorigin="anonymous"></script> <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script> <form id="myForm" action="comment.php" method="post"> Name: <input type="text" name="name"> Comment: <textarea name="comment"></textarea> <input type="submit" value="Submit Comment"> </form> <script> $(function() { var options = { target: '#divToUpdate', url: 'comment.php', beforeSubmit:function(formData, jqForm, option){ $("xxx").validate() //验证 }, success: function() { alert('Thanks for your comment!'); } }; $('#myForm').ajaxForm(options); }); </script> </head> ```