I want to add parameters to url without refreshing the page. I have used history.pushState
and history.replaceState
. I put a debugger on the function in javascript, when I debug history.pushState
, it replaces the url, but then it changes again to the previous.
What I want to is, e.g. below is my url
.../?id=1
Now I will click on one of my filters and the url must be as follows
.../?id=1,2
Then I will click on Search
button to apply filter. What should be the best practices?