jQuery form 表单提交插件

最后更新于:2022-04-02 03:14:19

[TOC] > [github链接](https://github.com/jquery-form/form) > [demo](https://jquery-form.github.io/form/) ## 引入 ``` ``` ## demo ```
Name: Comment:
``` ## 实例 ### 上传文件进度条 > [参考demo末尾](https://jquery-form.github.io/form/examples/) ``` var bar = $('.bar'); var percent = $('.percent'); var status = $('#status'); $('form').ajaxForm({ beforeSend: function() { status.empty(); var percentVal = '0%'; bar.width(percentVal) percent.html(percentVal); }, uploadProgress: function(event, position, total, percentComplete) { var percentVal = percentComplete + '%'; bar.width(percentVal) percent.html(percentVal); //console.log(percentVal, position, total); }, success: function() { var percentVal = '100%'; bar.width(percentVal) percent.html(percentVal); }, complete: function(xhr) { status.html(xhr.responseText); } }); ```
';