2011-08-17 42 views
0

我在同一頁面有三個ajaxStart程序。第一:主要,第二個在主要開放,第三個在第二個開放。所以我使用實時功能。這裏沒有問題。jquery ajaxStart /完全觸發其他程序

這裏是我的代碼:

第二個過程

$('#filmadres').live('click',function(event){ 
event.preventDefault(); 

    $.ajax({ 
//procedure 

     success: function(ajaxCevap) { 
      $('#filminfo').html(ajaxCevap); 
      $('#filminfo').show(); 
     } 
}); 

    $('#filminfo').bind('ajaxStart',function(){ 

     $('#filmlist').unbind('ajaxStart'); 
     $('#loading2').html('<img src="harici/ajax-fb-loader.gif" />'); 
     $('#loading2').show(); 

    }); 

    $('#filminfo').bind('ajaxComplete',function(){ 

     $('#filmlist').unbind('ajaxStop'); 
     $('#loading2').hide(); 
     $('#filminfo').show(1000); 

    }); 

,這是第三個過程

$('#postercek').live('click',function(event){ 
     event.preventDefault(); 

$.ajax({ 
//procedure 

    success: function(ajaxReply) { 
       $('#posterbilgisi').html(ajaxReply); 
      } 

     }); 

$('#posterbilgisi').bind('ajaxStart',function(){ 

    $('#filminfo').unbind('ajaxStart'); 
    $('#posterloading').html('<img src="harici/ajax-fb-loader.gif" />'); 
    $('#loading2').css('display','none'); 
    $('#posterloading').css('display','block'); 

}); 

$('#posterbilgisi').bind('ajaxComplete',function(){ 

    $('#filminfo').unbind('ajaxComplete'); 
    $('#posterloading').css('display','none'); 

}); 

而問題:

第二個ajaxStart/Complete功能不起作用。當我點擊#postercek時,第一個功能正在工作(filminfo ajaxStart)。但結果是真的,它顯示$('#posterbilgisi')。html(ajaxReply); 。只有在「加載」程序中才有錯誤。我必須做什麼?

我在哪裏犯錯?我很困惑...

+0

我不知道,但你並沒有結束'$阿賈克斯({ '在第二個過程中',這是一個複製/粘貼錯誤,還是你真的在你的代碼中有錯? – pimvdb

+0

不,我已經結束了,這裏沒有問題問題:點擊第三個鏈接(#postercek)觸發第二個鏈接(#filmadres)ajaxStart過程(ajax正常工作,我得到結果,但ajaxStart是第二個過程)。 – Benjamin

回答