JSFiddle - React, Tailwind, and code Playground
HTML
<a href="#example-name1">Profile 1</a>
<a href="#example-name2">Profile 2</a>
<div class="profile" id="example-name1">Profile 1</div>
<div class="profile" id="example-name2">Profile 2</div>
<div class="content"> Show content for (example-name1) and (example-name2) here dyanmically depending on the url. </div>
CSS
.content {
display:none
}
JavaScript
// On page load
$(document).ready(function(){
// Hide all extra content from main profiles page
$('.profile-hidden').hide();
// When the hash (#something) changes
window.onhashchange = function() {
// hide all profiles
$('.profile').hide();
// get the current hash minus '#'
var profileId = window.location.hash.substr(1);
// show only the appropriate profile
$('#' + profileId).show();
$('.content').show();
if($.post("findimgs.php",{
name : profileId,
token : 'sdfsdf7823ruhyewf78ads6734r123ty12tf67sgv13478y67ef'
}, function(postback){
$('.content').append(postback);
alert(postback);
}));
};
});