I used this existing question to help me out: HTML - Change\\Update page contents without refreshing\\reloading the page
The template-comparison.php file fetches the
If you are using jQuery you can avoid DOM onClick
triggers and use the jQuery events instead. Also when you have a hashtag as href
in your anchors it puts the hashtag in the URL when clicked because it assumes it is an element ID. You can change that as show below, or even ommit it:
link text
Now you can bind the events using jQuery:
$(document).ready(function(){
$('.foo').on('click', function(e){
e.preventDefault();
prescand($(this).data("target"));
});
});
You might also use the $('a')
jQuery selector, but usually you want to be a bit more specific and target only certain anchors by grouping them together with a certain class.
The loading function is OK as is.