zoukankan      html  css  js  c++  java
  • ajax 未加载出数据时,显示loding,数据显示后,隐藏loading

    $("#CreateReport").click(function () {
    // RptID,Template,TemplateType,FileName
    var RptID = $("#gridList").jqGridRowValue().RptID;
    var Template = $('#' + RptID + "_Template").val();
    var TemplateType = $('#' + RptID + "_TemplateType").val();
    var FileName = $("#gridList").jqGridRowValue().FileName;

    if (Template == "" || Template == undefined) {
    $.modalAlert("报告模版还未选择,请点击报告模版选择", 'error');
    return false;
    } else if (Template == "请选择报告模版") {
    $.modalAlert("请选择正确的报告模版", 'error');
    return false;
    } else {
    $.ajax({
    url: "#",
    data: {
    RptID: RptID,
    Template: Template,
    TemplateType: TemplateType,
    FileName: FileName
    },
    async: true,//必须是异步加载的
    method: "POST",
    beforeSend: function () {
    $('#loadingPage', parent.document).css("display", "block");
    },
    success: function (result) {
    var result = JSON.parse(result);
    if (result["state"] == "success") {
    $.modalAlert("成功生成报告,请在已出报告查看", 'success');
    $.currentWindow().$("#gridList").trigger("reloadGrid");
    } else {
    $.modalAlert(result.message, 'error');
    }
    },
    complete: function () {
    $('#loadingPage', parent.document).css("display", "none");
    },
    error: function () {
    $.modalAlert("出错了", 'error');
    }
    })
    }

    })

  • 相关阅读:
    谈谈Nginx有哪些特点
    网站嵌入百度地图制作
    8张图理解Java
    linux问题-easy_install安装bpython时报错
    linux问题-Centos 安装Sublime text 3
    python例子-Nmap扫描IP并更新
    python例子-PyQuery抓取信息.
    python例子-MySQLdb和练习题
    python例子-线程和队列
    mysql问题-centos7中mysql远程连接问题
  • 原文地址:https://www.cnblogs.com/quitpoison/p/9802044.html
Copyright © 2011-2022 走看看