飞比寻常 (JOE) 生,简单,活,简单,生活,不简单!
JOE个人网站
JOE个人网站,不仅仅是一个网站,更像是一个展现自我的平台,致力于让朋友们都可以
有所感触,有所收获。
在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后把该图标移除掉!!!!