function parse_query_string(query) { var vars = query.split("&"); var query_string = {}; for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); var key = decodeURIComponent(pair[0]); var value = decodeURIComponent(pair[1]); // If first entry with this name if (typeof query_string[key] === "undefined") { query_string[key] = decodeURIComponent(value); // If second entry with this name } else if (typeof query_string[key] === "string") { var arr = [query_string[key], decodeURIComponent(value)]; query_string[key] = arr; // If third or later entry with this name } else { query_string[key].push(decodeURIComponent(value)); } } return query_string; } jQuery(document).ready(function() { var query = window.location.search.substring(1); var qs = parse_query_string(query); var TID = qs.TID; if(TID == null){ jQuery("#Steuernews").html(""); $('#news').masonry({ // options itemSelector: '.newsitem', isFitWidth: true }); }else{ $.ajax({ type:"GET", url:"//kunden.infomedia.co.at/inframing/langer-pfarl/artikel.php?UID=1581&TID="+TID, success: function(result) { jQuery("#Steuernews").html(result); }}); } $('.article').click(function(){ var url = new URL(window.location); url.searchParams.append('x', 42); var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?TID='+this.id; window.history.pushState({ path: newurl }, '', newurl); $.ajax({ type:"GET", url:"//kunden.infomedia.co.at/inframing/langer-pfarl/artikel.php?UID=1581&TID="+this.id, success: function(result) { jQuery("#Steuernews").html(result); } }); }); });