Reputation: 926
Snippet code to load the content of the template into the div (main.html):
var href = $(this).attr('href');
$('#content_pane').load( href );
<a href="/main" class="active"> MAIN </a>
<a href="/review"> REVIEW </a>
<div id="#content_pane"> </div>
review.html:
<a href="review/1" class="pageLink"> 1 </a>
<a href="review/2" class="pageLink"> 2 </a>
My question now is that:
EDIT
Current Problem:
The class .pageLink from review.html is not accessible from main.html, after review.html being loaded into div #content_pane
Can anyone help on this please ?
Upvotes: 0
Views: 1218
Reputation: 926
The problem solved by following:
Upvotes: 0
Reputation: 8176
Ok if I understood you correctly,
You want a way to load more content after the ajax call for those links has finished.
For this (If your using jQuery) I would do this:
You will need to use :".delegate()" function. (for more info read here).
Now for the code:
<script>
var href = $(this).attr('href');
$('#content_pane').load( href );
$('#content_pane').delegate('#your-link-id-here', 'click', function(){
var href2 = $('.your-link-class-here').attr('href');
$('#content_pane').load( href2 );//If you want your links to stay, put another div insted of content_pane.
});
</script>
<a href="/main" class="active"> MAIN </a>
<a href="/review"> REVIEW </a>
<div id="#content_pane"> </div>
Upvotes: 1