zoukankan      html  css  js  c++  java
  • ajax监听上传进度

    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中可以或得到上传进度数据

    }),

  • 相关阅读:
    codevs1430 素数判定
    codevs1212 最大公约数
    codevs1012 最大公约数和最小公倍数问题
    codevs1160 蛇形矩阵
    Debate CodeForces
    Divide Candies CodeForces
    Login Verification CodeForces
    Colorful Bricks CodeForces
    ExaWizards 2019 English D
    Cards and Joy CodeForces
  • 原文地址:https://www.cnblogs.com/zyzhao/p/7071052.html
Copyright © 2011-2022 走看看