Reputation: 21
So I am trying to populate main content div from another html file.
I have first two links like this:
<a href="" class="load-page" data-location="./content/johdanto.html">Johdanto</a>
<a href="" class="load-page" data-location="./content/vastuualueet.html">Vastuualueet</a>
and main content div set up like so:
<div class="main" id="content">
jquery like this
$('.load-page').on('click', function(event)
{event.preventDefault();
$('#content').load($(this).data('location'));
});
populating the div works but it only loads the first file no matter what link I click, need some help with this :(
Upvotes: 1
Views: 61
Reputation: 21
if someone runs into this,
$('.load-page').on('click', function(event)
{event.preventDefault();
$.ajaxSetup({ cache: false });
$('#content').load($(this).data('location'));
});
setting the cache to false fixed it for me :)
Upvotes: 1