Jquery novice here with a quick question. I have two empty containers in the html:
<aside></aside>
<section></section>
Then I load content into it:
$('aside').load('timeline.html #dates');
$('section').load('timeline.html #intro');
#dates
contains links that, when clicked on, should replace and load its url content into <section>
without reloading the whole page. I tried making a click handler but it's not working (on click still leaves current page and goes to url):
$('a').click(function(e) {
e.preventDefault();
e.stopPropagation();
var url = $(this).attr("href");
$('section').empty().load(url);
});
I even tried this variation to no avail:
$('aside a').on('click', function() {
var url = $(this).attr("href");
$('section').empty().load(url);
return false;
});
I could use iframes, but I don't want to since I'm learning about .load(). Any suggestions?