2009-10-16 64 views
-1

我寫下面的代碼jQuery的負載功能

 <script type="text/javascript"> 
     $(document).ready(function() { 
     $('#disp').load('index.php', function(){ 
     $('#lobar').hide(); 
     }); 

    }); 
    </script> 

我需要在加載頁面加載index.php來格命名爲:DIS

感謝

+0

你問過'dis'元素,但在你的源文件中你引用了'disp'元素。確保你的div的名字。 – Kamarey 2009-10-16 16:57:27

回答

3
$(function() { 
    $('#disp').load('index.php', {}, function(){ 
     $('#lobar').hide(); 
    }); 
}); 
1

負載()函數需要3個參數,但您只能傳入2.請參閱this link上的加載函數的文檔。我想你想傳遞一個null作爲第二個參數來實現你想要的結果。

$('#disp').load('index.php', null, function(){ 
    $('#lobar').hide(); 
}); 
+0

第二個和第三個參數是可選的,您可以通過第三個而不需要第二個參數。查看jQuery庫的源代碼。 – Kamarey 2009-10-16 16:54:44