I am loading content into a div with the following script:
$.ajaxSetup({cache:false});
$(".ajaxlink").click(function(){
var post_link = $(this).attr("rel");
$(".ajax-content").html("<div class='loading'></div>");
$(".ajax-content").load(post_link+ ' #page');
$(".ajax-bottom-bar").show();
return false;
});
When clicking on a hyperlink in the page with the class .ajaxlink, it gets the destination URL from the rel and then loads the content from within the page into .ajax-content
My problem is that within the loaded content, there are also further links that also include .ajaxlink however when clicking on them, instead of loading into .ajax-content, these links act like a normal link and open the linked page normally.
Links that exist outside of the loaded content still load properly into ajax-content.
I'd like to know how I can ensure that the links inside the loaded content will also load into ajax-content. Note that I am pulling the content from a specific div on the destination page.
I know that ajax/jquery tends to strip scripts out of loaded content, but given that the script exists in the source page itself, I do not see why it would need to be loaded into the div too. Either way, I attempted using "$.getScript" to load the script and I still got the behavior I described above.
Hope someone can help me get this working and also point out what the problem is so I can know for next time.