码迷,mamicode.com
首页 > Web开发 > 详细

ajax监听上传进度

时间:2017-06-23 18:20:03      阅读:282      评论:0      收藏:0      [点我收藏+]

标签:margin   return   ==   上传   ace   进度   nbsp   gre   函数   

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监听上传进度

标签:margin   return   ==   上传   ace   进度   nbsp   gre   函数   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!