views:

25

answers:

1

Hi, simple question mostly explained in the title. I need to load up a page, but just it's #container div. I can't, though.

<div id="top"><a href="index.php">Home</a> | <a href="operators.php">Operators</a></div>
<script type="text/javascript">
$('#top a').click(function(){  
        var pageURL=$(this).attr('href');
 $('#container').fadeOut(100);
 $('#container').load(pageURL, '#container');
 $('#container').fadeIn(400);
 return false;
});
</script>
<div id="container">
////content...
</div>

That's the code I'm using. I want the jQuery to load up the page I have in pageURL, which just grabs the href of the link. That works. It's the part where it has to load the variable that doesn't work.

It can load the variable by itself, but as soon as I try to make it load just the #container, it crashes. No errors. Nothing.

How can I get it to work as desired?

Thanks :)

-Jaxo

A: 

$('#container').load(pageURL, '#container'); should be $('#container').load(pageURL+' #container');

According to the .load() API, it's $('item').load('url #container');

Rocket