CSS3的颜色透明度 ajax请求时loading

1.background-color:rgba(0,0,0,0.65)         这行代码让覆盖层变黑色,且有0.6的透明度

正常情况下遮盖层会把透明度遗传给弹出框(它的子元素),但是利用CSS3的这个特性则不会

2.

 

在ajax方法中定义任意位置显示的“加载中。。。”提示

$('#ajax_test2').click(function(){
     $.ajax({
          url ---- url路径,根据你需要些啦,
          type:'post',
          data:'name=ZXCVB',
          timeout:15000,
          beforeSend:function(XMLHttpRequest){
              //alert('远程调用开始...');
              $("#loading").html.("<img src='/jqueryStu/images/loading.gif' />");
         },
         success:function(data,textStatus){
             alert('开始回调,状态文本值:'+textStatus+' 返回数据:'+data);
             // $("#loading").empty();
           },
          complete:function(XMLHttpRequest,textStatus){
              // alert('远程调用成功,状态文本值:'+textStatus);
             $("#loading").empty();
           },
           error:function(XMLHttpRequest,textStatus,errorThrown){
              alert('error...状态文本值:'+textStatus+" 异常信息:"+errorThrown);
             $("#loading").empty();
          }
       });
    });

< input type.="button" id="ajax_test2" value="Ajax方式">
  <div id="loading"></div>

很明显,在beforeSend时,在指定的位置显示“加载中。。。”图标,在error、complete、success后把该图标移除掉!!!!

posted @ 2015-07-10 16:16  刺蛇笑眯眯  阅读(265)  评论(0编辑  收藏  举报