How to fix the code so the url was adequate?

Hi all. Here is the code
$(document).ready(function() {

 // Check for hash value in URL
 var hash = window.location.hash.substr(1);
 var href = $('#nav-page li a').each(function(){
 var href = $(this).attr('href');
 var toLoad = hash+'.html #content-page';

 $('#nav-page li a').click(function(){

 var toLoad = $(this).attr('href')+' #content-page';
 $('#content-page').append('<div class="load-page"><p>LOADING...</p></div>');
 window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length=100);
 function loadContent() {
 function showNewContent() {
 function hideLoader() {

 var title = $('.title-page').text();
 var bread = $('.breadcrumb-item-page').text(); 
 return false;


The code works but it doesn't show the correct url for example

How to make it for example when loading another page


As I understand the bug is in this line I just don't know how to fix it
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length=100);
April 19th 20 at 12:10
1 answer
April 19th 20 at 12:12
window.location.hashtry to replace window.location.href

Find more questions by tags jQueryMODXJavaScript