views:

189

answers:

1
    <script type="text/javascript">
$(document).ready(function() {
     $('a.menuitem').click(function() {
                      var link = $(this), url = link.attr("href");
                          var newDiv = '<div></div>';
                          $("#content_pane").append(newDiv);
                          newDiv.load(url);
                          return false; // prevent default link-behavior
              });

 });
   </script>
</head>
<body>
 <li><a class="menuitem" href="inspiration">Inspiration</a></li>
 <li><a class="menuitem" href="blog">Blog</a></li>
 <div id="content_pane">

 </div>
</body>
</html>

The above code is semi working, when I click the button a new div id created but it prints out load(url) on the page instead of showing the page content that it is supposed to be loading does any one have any tips?

+1  A: 

Try this:

var link = $( this ), url = link.attr( "href" );
var newDiv = $( document.createElement( 'div' ) );
$( "#content_pane" ).append( newDiv );
newDiv.load( url );
return false;
Jacob Relkin
uncommented the line and sorted my vars out...it just navigates me to the page as normal, it should load the content into my current page
sico87