首页 > Web开发 > 详细

ajax监听上传进度

时间:2017-06-23 17:55:24      阅读:333      评论:0      收藏:0      [点我收藏+]

var xhrOnProgress = function(fun) {

xhrOnProgress.onprogress = fun; //绑定监听函数

return function() {

var xhr = $.ajaxSettings.xhr();

if(xhrOnProgress.onprogress == null || typeof xhrOnProgress.onprogress === ‘undefined‘)

return xhr;

if(xhrOnProgress.onprogress && xhr.upload) {

xhr.upload.onprogress = xhrOnProgress.onprogress;

}

return xhr;

}

};

 

timeout: 1000 * 60,

xhr: xhrOnProgress(function(e) {

console.log(e)

//这里是监听函数 从e中可以或得到上传进度数据

}),

ajax监听上传进度

原文:http://www.cnblogs.com/zyzhao/p/7071052.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!