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

    }),

  • 相关阅读:
    Android基础知识之拼写检查框架
    Android USB配件模式
    Android基础知识之Manifest中的Intent-filter元素
    如何使Android应用支持多种屏幕分辨率
    优惠券系统设计(系统设计设计篇)
    优惠券系统设计(数据库设计篇)
    优惠券系统设计(产品设计篇)
    java 文件断点续传实现原理
    java sleep和wait的区别的疑惑?
    java中的中断Thread.interrupt()意味着什么?
  • 原文地址:https://www.cnblogs.com/zyzhao/p/7071052.html
Copyright © 2011-2022 走看看