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');
if(hash==href.substr(0,href.length-5)){
 var toLoad = hash+'.html #content-page';
$('#content-page').load(toLoad)
 } 
});

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

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

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

});
});


The code works but it doesn't show the correct url for example
http://goodbadnewsapp.com/uslugi/tovarnyie-znaki/mezhdunarodnaya-registracsia#uslugi/tovarnyie-znaki/podgotovka-vozrazheniya-na-otkaz-registr


How to make it for example when loading another page
It
http://goodbadnewsapp.com/uslugi/tovarnyie-znaki/registracziya-tovarnogo-znaka

Became
http://goodbadnewsapp.com/uslugi/tovarnyie-znaki/proverka-tovarnogo-znaka

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