jQuery的负载功能

问题描述:

我写下面的代码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

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

负载()函数需要3个参数,但您只能传入2.请参阅this link上的加载函数的文档。我想你想传递一个null作为第二个参数来实现你想要的结果。

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

第二个和第三个参数是可选的,您可以通过第三个而不需要第二个参数。查看jQuery库的源代码。 – Kamarey 2009-10-16 16:54:44