I'm trying to load all my website pages using jQuery .load method so, thats how my website looks:
<script type="text/javascript">
$(function() {
$('.link').bind('click', function(e) {
var page = $(this).attr('href');
$('#site').addClass('loading');
$('#content').load(page, function (){
$('#site').removeClass('loading');
});
e.preventDefault();
return false;
});
<a href="test.php" class="link">Test</a>
With this code, every link that gets class="link" will load my page on the div #content. Works fine! No problems but when I load the test.php, if i use the class="link" on any link, or button, or whatever, it just does not work and the new page is loaded outside my #content.
Already tried to copy this to the new-loaded file and it doesn't work, anyone got a hint?
Thanks