ilopx/jquery-ajax-progress
最新稳定版本:1.2.1
Composer 安装命令:
composer require ilopx/jquery-ajax-progress
包简介
Simple patch that adds a 'progress' callback to jquery Ajax calls
README 文档
README
A simple patch to jQuery that will call a 'progress' callback, using the XHR.onProgress event
Video demo
Install and use
a. CDN
jquery.ajax-progress.js or jquery.ajax-progress.min.js
Include the script on your page:
<script src="https://cdn.rawgit.com/ilopX/jquery-ajax-progress/master/dist/jquery.ajax-progress.js"></script>
or
<script src="https://cdn.rawgit.com/ilopX/jquery-ajax-progress/master/dist/jquery.ajax-progress.min.js"></script>
b. Install
bower install ilopx-jquery-ajax-progress
composer require ilopx/jquery-ajax-progress
Use simple template script
$(function() { $.ajax({ method: 'GET', url: '', // TODO: add url data: { // TODO: add data }, success: function() { // TODO add message all ok }, error: function() { // TODO add message error }, progress: function(e) { if(e.lengthComputable) { var progress = e.loaded / e.total * 100; var content = e.srcElement.responseText; } else { // TODO add message error 'Content Length not reported!'; } } }); });
Notes
- This will not work using the
file://protocol, see XMLHttpRequest - Monitoring Progress for more info.
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-23