无为清净楼资源网 Design By www.qnjia.com

jQuery中通过ajaxStart()和ajaxStop()两个方法提供了类似的功能。当一个Ajax请求启动时,并且没有其他未完成的Ajax请求时,将调用ajaxStart()方法。同样,ajaxStop()方法则是在所有Ajax请求都完成时调用。这些方法的参数都是一个函数,这个函数将在事件发生时被调用。

例子
复制代码 代码如下:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <script src="/UploadFiles/2021-04-02/jquery-1.4.2.min.js">      <script type="text/javascript">
        $(document).ready(function(){

         $("#Button1").click(function(){
          $.post("Default2.aspx","",function(data){
           $("#x").text(data);
          },"text");
         });
         $("#my").ajaxStart(function(){
             $(this).show();
         }).ajaxStop(function(){
           $(this).hide();
         });

        });
  </script>
</head>
<body>
    <form id="form1" runat="server">

 
    <input id="Button1" type="button" value="button"  />
    <div id="my" style=" display:none">
        <img src="/UploadFiles/2021-04-02/loading.gif">    </div>
    <div id="x"></div>
    </form>
</body>
</html>

标签:
Jquery,ajaxStart,ajaxStop

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com