im looking for a way to remove the URL param after clicking the button.
The reaseon for it is i want to do something on my page on connecting if i have the url param. if not do the default thing. the problem is that if i have the param in url it will do the same thing every time i refresh the page.
my webpage contains a nav menu. on titel pressed a php file loads into the page to show something.
so the end point is if i got an param and i finished my job and refreshed the webpage, then i dont want to go there where the param takes me.
this operation should be done using JQuery or JS.
im not sure how to describe the problem more then that. comment if you got a question.
thanks for all
UPDATE
here is my code:
const urlParams = new URLSearchParams(window.location.search);
const myParam = urlParams.get('vertrag');
if (typeof myParam !== 'undefined' && myParam !== null) {
tabCaller("ver_vert_sicht", `id=${myParam}`);
}
function tabCaller(tabName, parameter = null) {
//Get the current tab div id
var current = `#nav_${$("#content").children(":first").attr("id")}`;
//empty the Content Div
$("#content").empty();
//move the "nav_selected" class from the old nav_option to the new one
$(current).removeClass("nav_selected");
$(`#nav_${tabName}`).addClass("nav_selected");
var tabUrl = `action/php/inc/${tabName}.inc.php?${parameter}`;
console.log(tabUrl);
$.ajax({
url: tabUrl,
success: function(data) {
$("#content").html(data);
}
});
}
HTML:
<div id="navMenu">
<button onclick="tabCaller('customers')">Customers</button>
<button onclick="tabCaller('orders')">Orders</button>
<button onclick="tabCaller('invoice')">Invoice</button>
</div>
<div id="content">
</div>