2009-11-26 152 views
0

多回调代码:

<script> 
    $(document).ready(function(){ 
     $.get("realisations.shtml",function(data){$('#realisations').empty().append(data)}); 
    }); 
</script> 

我需要执行$( “toexpand”)隐藏(); beeing确认后的数据加载到DIV

这种尝试不工作:

<script> 
    $(document).ready(function(){ 
     $.get("realisations.shtml",function(data){$('#realisations').empty().append(data)},function(){$(".toexpand").hide()}); 
    }); 
</script> 
+1

您不需要有多个回调,只需在单个回调中执行多个语句即可。 – tvanfosson 2009-11-26 14:36:44

回答

2
$(document).ready(function(){ 
    $.get("realisations.shtml",function(data) { 
     $('#realisations').empty().append(data); 
     $(".toexpand").hide(); 
    }) 
}); 
0
<script> 
$(document).ready(function(){ 
    $.get("realisations.shtml",function(data) { 
     $('#realisations').empty().append(data); 
     $(".toexpand").hide(); 
    }); 
}); 
</script> 
0

有没有你不使用$一个原因()的load()?

$(document).ready(function(){ 
    $('#realisations').load("realisations.shtml", function() { 
     $(".toexpand").hide(); 
    }); 
});