I am working on a web application where I need to add and remove variables from the URL. I have done on click adding variables to the URL but I it adds duplicates variable.
href="http://localhost<?php echo $_SERVER['REQUEST_URI'];?>?budget=1-lakh-3-lakh"
First Click on link:
http://localhost/auto/search.php?budget=1-2L
Second Click on same link:
http://localhost/auto/search.php?budget=1-2L&budget=1-2L
I want to remove variable from the URL if it is already exist else add variable on a link click.
I already tried lot's of method but I am not getting the result. With jQuery I tried replace(), indexOf().