Loading Content Into The Same Div
Fairly new to the Jquery game and I must say it rocks. I am trying to load new contents of one page into the div of a current page. My test URL can be found here.
http://www.tomtimms.com/developer.
When the first url (contact) is clicked the contents are loaded into the div, however if you click on the next link (about) it takes you straight to the about page as the contents are not loaded . Can anyone assist on how I can make this happen? I think it has something to do with the dom already being loaded.
Here is my code
- $(document).ready(function() {
- $('#content a').click(function(){
-
- var toLoad = $(this).attr('href')+' #content';
- $('#content').hide('fast',loadContent);
- $('#load').remove();
- $('#wrapper').append('<span id="load">LOADING...</span>');
- $('#load').fadeIn('normal');
- function loadContent() {
- $('#content').load(toLoad,'',showNewContent())
- }
- function showNewContent() {
- $('#content').show('normal',hideLoader());
- }
- function hideLoader() {
- $('#load').fadeOut('normal');
- }
- return false;
-
- });
-
-
- });