//导出表格加载中的提示
var dian=0;//控制'●'的个数
var t=null;//停止时使用
function id_loadspot(loadspotSpan,loadingDiv,exportLink){
  loadingDiv.css('visibility','visible');//显示
  exportLink.click(function(){//使链接失效
    return false;
  });
  t=setTimeout(function() {
    if (dian >= 3) {
      loadspotSpan.text('');
      dian = 0;
    } else {
      dian++;
      loadspotSpan.text(loadspotSpan.text() + '●');
    }
    id_loadspot(loadspotSpan,loadingDiv,exportLink);//递归调用
  }, 1000);

}
//停止加载中的提示
function stop_id_loadspot(loadingDiv,exportLink){
  clearTimeout(t);//停止定时器
  loadingDiv.css('visibility','hidden');//隐藏
  exportLink.unbind("click");//使链接生效
}

//页面

<div  style="width: 10%; height: 30px; float: right; text-align: left;">
<a href="javascript:exportMerchantExcel();"  style="text-align: center;" class="audit" id="exportLink">导出</a>
  <div style="display: inline-block;visibility:hidden; width: 66px; text-align: left;" id="loadingDiv">
    加载中<span id="id_loadspot"></span>
  </div>
</div>

//使用

seachKey = $("#merchantName").val();
status =$('#upsfyx').combobox('getValue');

//加载中...
id_loadspot($('#id_loadspot'),$("#loadingDiv"),$("#exportLink"));
$.ajax({
  url : '../system/cisweb/exportMerchantExcel',
  dataType : "json",
  type : "post",
  data : {
  seachKey : seachKey,
  status:status,
  },
  success : function(data) {
  if (data.status == "succeed") {
    $("#download").attr("href", data.path);
    $("#subBtn").trigger("click");
  } else {
  $.messager.alert('提示', data.msg, 'error');
}
},
error : function(err) {
  $.messager.alert('提示', err.msg, 'error');
},

complete:function(jqXHR, textStatus){
  stop_id_loadspot($("#loadingDiv"),$("#exportLink"));//停止加载中的提示
}

});

jQuery实现加载中效果,防止重复提交的更多相关文章

  1. 使用Bootstrap3和Ladda UI实现的多种按钮“加载中”效果体验

    在线演示 在线演示 大家在开发基于web的网站或者web应用中,常常在AJAX调用的过程中需要提示用户并且展示相关的“加载中”效果,类似的UI设计也非常多,比如,当点击一个按钮后,在它的旁边显示一个 ...

  2. WPF防止界面卡死并显示加载中效果

    原文:WPF防止界面卡死并显示加载中效果 网上貌似没有完整的WPF正在加载的例子,所以自己写了一个,希望能帮到有需要的同学 前台: <Window x:Class="WpfApplic ...

  3. jquery mobile在页面加载时添加加载中效果 document.ready 和window.onload执行顺序比较

    想要添加这个效果,先来弄明白页面的加载和事件执行顺序,看这个简单例子: <html xmlns="http://www.w3.org/1999/xhtml"> < ...

  4. jquery实现加载更多效果

    情况是当滑动条滑动到最底部的时候,数据显示出一部分的更多 思路:获取到浏览器屏幕的高度client,文档的高度h和滑动距离顶部的距离scroll,当h<=client+scroll的时候就是滑动 ...

  5. JQuery 数据加载中禁止操作页面

    比较常见的做法,但对我而言是第一次做,记录一下. 为了把找来的loading.gif 的背景色设置为透明,还特意装了quicktime. 有学到一些额外的东西. 先将div及img定义好 <bo ...

  6. Android 三种方式实现自定义圆形页面加载中效果的进度条

    转载:http://www.eoeandroid.com/forum.php?mod=viewthread&tid=76872 一.通过动画实现 定义res/anim/loading.xml如 ...

  7. 【转】WPF防止界面卡死并显示加载中效果

    原文地址:http://www.cnblogs.com/linyijia/archive/2013/02/06/2900609.html <Window x:Class="Loadin ...

  8. CSS3实现加载中效果

    代码: <!doctype html> <html> <head> <meta charset="utf-8" /> <tit ...

  9. loading加载中效果

    (function(){ try{ var ui={ loading:{ addCssStyle:function(text) { var head = document.getElementsByT ...

随机推荐

  1. linux压缩包安装jdk

    1.下载jdk压缩包 $ wget http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa00 ...

  2. elasticsearch2.x插件之一:kibana

    介绍: 要说kibana,就不得不先说一下logstash.这里呢,先要讲个故事.故事是开头是这样的,Logstash早期曾经自带了一个特别简单的logstash-web用来查看ES中的数据,其功能太 ...

  3. Spring开发包介绍

    -----------------siwuxie095                         核心开发包         建立 Spring 工程时,需要引入 Spring 的开发包,否则无 ...

  4. linux 安装 elasticsearch

    安装 Java 8 当你提前在使用 Elasticsearch,你开始寻找更好的 Java 性能和兼容性时,您可以选择安装 Oracle 的专有 Java (Oracle JDK 8). 将 Orac ...

  5. Jmeter连接MySQL配置(能执行多条sql语句)

    Database URL为MySQL的连接串,如果要执行多条SQL语句,后面还要添加“?allowMultiQueries=true”

  6. linux上运行jmeter-server失败

    1. 在linux上运行jmeter-server报如下错误 处理办法: 通过如下命令运行 ./jmeter-server -Djava.rmi.server.hostname=192.168.16. ...

  7. 12、geo数据上传

    1.注册一个NCBI账户 注册geo账户(老用户和新用户): https://www.ncbi.nlm.nih.gov/geo/submitter/ 有3个月的时间 GEO DataSets > ...

  8. Centos6.8下yum安装python2.7

    下载 ius-release.rpm包 wget https://centos6.iuscommunity.org/ius-release.rpm 安装ius-release.rpm包 rpm -Uv ...

  9. 掌握HDFS的Java API接口访问

    HDFS设计的主要目的是对海量数据进行存储,也就是说在其上能够存储很大量文件(可以存储TB级的文件).HDFS将这些文件分割之后,存储在不同的DataNode上, HDFS 提供了两种访问接口:She ...

  10. 基于http的多进程并发文件服务器

    1 可以掌握的知识点 (1) 线上部署时的守护应用 (2) 常规的文件操作,配置文件读取 (3) 网络编程,端口复用等文件 (4) 多进程知识 2 代码注释如下 test_httpd.h #inclu ...