zoukankan      html  css  js  c++  java
  • 为jquery ajax请求增加正在运行提示

    在jquery源码中增加showMask()方法调用:

    if ( xhrSupported ) {

    jQuery.ajaxTransport(function( options ) {
    // Cross domain only allowed if supported through XMLHttpRequest
    if ( !options.crossDomain || support.cors ) {

    var callback;

    return {
    send: function( headers, complete ) {

    showMask();

    ......

    在jquery源码中增加hideMask()方法调用:

    // Callback for when everything is done
    function done( status, nativeStatusText, responses, headers ) {
    //alert(1);
    hideMask();
    var isSuccess, success, error, response, modified,
    statusText = nativeStatusText;

    // Called once
    if ( state === 2 ) {
    return;
    }

    ......

    //调用的是easyui的效果

    // Load
    function showMask() {
    $("<div class="datagrid-mask"></div>").css({ display: "block", "100%", height: $(window).height() }).appendTo("body");
    $("<div class="datagrid-mask-msg"></div>").html("正在运行,请稍候。。。").appendTo("body").css({ display: "block", left: ($(document.body).outerWidth(true) - 190) / 2, top: ($(window).height() - 45) / 2 });
    }
    // hidden Load
    function hideMask() {
    $(".datagrid-mask").remove();
    $(".datagrid-mask-msg").remove();
    }

    参考文件:

  • 相关阅读:
    联赛前第五阶段总结
    陶陶摘苹果 —— 线段树维护单调栈
    联赛前第三阶段总结
    联赛前第四阶段总结
    [NOIP
    超级跳马 —— 矩阵快速幂优化DP
    我的博客园美化
    Wedding —— 2-SAT
    C++运算符优先级
    water——小根堆+BFS
  • 原文地址:https://www.cnblogs.com/snow365/p/6165020.html
Copyright © 2011-2022 走看看