I am developing a site where I want to get all the links from the navigation bar, and load the div from the linked pages into a large container. So far, I mean the following:
$('nav a').each(function(index){
var to_load = $(this).attr('href') + '#slides section';
$('<section>').load(to_load, function(){
$('#slides').append($(this).html());
});
});
This works great, except that it almost always failed, possibly due to its asynchronous loading. Is there a way to load each at a time, so the partitions will be in order, while maintaining flexibility?
Thanks for the heaps in advance!
source
share