I have code, that looks something like this:
(function($) {
$(document).ready(function() {
function getHash(){
var h = document.location.href.split('#');
return h.length == 1 ? "" : h[1];
}
var $newdiv = $('...html code here...');
function checkit() {
if(getHash() != "#ignoreDivButton")
$('html').html($newdiv);
}
checkit();
$('#ignoreDivButton').click(function(){
document.location.href = document.location.href.split('#')[0] + "#ignoreDivButton";
location.reload();
});
});
})(jQuery);
What I need, is to reload page by clicking on #ignoreDivButton but without loading the newdiv. I just can’t get how to ignore the variable. Thank you in advance.
can set a variable into a cookie, localStorage or even into the url(hash) :