Using jquery (or vanilla javascript - not the library) how can I replace the content of a div when a user clicks a link that is contained in that div? For example
<div id="content">
<a href="foo">bar</a>
</div>
$(document).on('click', 'a', function() {
var url = $(this).attr('href');
$('#content').load(url + '.php');
return false;
}
Obviously clicking on the link yields no results. Is there a clean way of doing this besides using React or something lol