2013-04-10 28 views
0

我實際上正在嘗試爲我的應用程序提供'人體工程學觸摸',所以我獲得了3個鏈接,可以獲取html內容並將其加載到div中。除了僅在第一次請求期間出現的加載器之外,所有工作都正常。Jquery loader只適用於第一個請求

這裏是我的代碼

$(document).ready(function() { 

$('#loader') 
.hide() // hide it initially 
.ajaxStart(function() { 
    $(this).show(); 
}) 
.ajaxStop(function() { 
    $(this).hide(); 
}); 

var uri_segment = "<?=$this->uri->segment(3);?>"; 


$('#editTeam').click(function (e) { 

    e.preventDefault(); 
    $(this).parent().siblings().removeClass('active'); 

    $(this).parent('li').addClass('active'); 



    $.ajax({ 
     type : "GET", 
     async : true, 
     url : "<?=base_url().'ajax/team/get_editTeam/';?>"+uri_segment, 
     dataType : "html", 
     success : function(data){ 
       $('#divPage').html(data); 

     } 
    }); 

    return false; 
}); 

$('#editRights').click(function (e){ 
    e.preventDefault(); 

    $(this).parent().siblings().removeClass('active'); 


    $(this).parent('li').addClass('active'); 

    $.ajax({ 
     type : "GET", 
     async : false, 
     url : "<?=base_url().'ajax/team/get_editRights/';?>"+uri_segment, 
     dataType : "html", 
     success : function(data){ 
       $('#divPage').html(data); 
     } 
    }); 
    return false; 
}); 


$('#addMember').click(function (e){ 

    e.preventDefault(); 

    $(this).parent().siblings().removeClass('active'); 


    $(this).parent('li').addClass('active'); 



     $.ajax({ 
      type : "GET", 
      async : false, 
      url : "<?=base_url().'ajax/team/get_addMember/'.$this->uri->segment(3);?>", 
      dataType : "html", 
      success : function(data){ 
       $('#divPage').html(data); 

      } 
     }); 
     return false; 
}); 


}); 
+0

控制檯中的任何JS錯誤? – scottheckel 2013-04-10 22:11:17

+0

沒有:/所有罰款,同樣的阿賈克斯請求 – TLR 2013-04-10 22:15:00

+0

我在ajaxStart和ajaxStop中添加了一個日誌,它工作正常。也許這是由於緩存? – TLR 2013-04-10 22:20:38

回答

相關問題