Wednesday, September 30, 2009

[jQuery] Re: Using a selector with .load() doesn't execute script?

hi, maybe de problem is the script inside the page you call with ajax.
 
try this :
 
<script type="text/javascript">
     $(document).ready(function()
     {
       $('#nav a').click(function()
       {
         $('#contentHolder').load('content.html #toLoad',{},function(data){
        
               $('#contentDiv').fadeOut('slow', function() {} );
               or
               $(data).filter(#contentDiv').fadeOut('slow', function() {} );
              //here put all code for page you call with ajax
         
        });
         return false;
       });
     });
 
and remove this 
 
<script type="text/javascript">
     $('#contentDiv').fadeOut('slow', function() {} );
</script>
--
Atte.
Carlos Becar.

No comments: