I make a website with news, when you click on the read more button (the opening of the full news), the news is loaded from the php file via ajax and changes the window.location.hash to the id this news. How to make it so that when opening a link with an already existing window.location.hash this news opens?
The code that loads the news and assigns hash:
$('.contentshortnews').on('click', '.full-opener', function(){ var newsid = $(this).attr('id'); $.post('http://jarwis-master.ru/php/newsget.php', { newsid: newsid }, function(data){ window.location.hash = 'news-'+newsid; $('.datanews').html(data); }); });