2011-08-17 129 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

回答