didsun didsun - 1 year ago 191
Javascript Question

JavaScript remove parameter from URL

I want to remove parameter from URL.
I have this URL http://localhost/?page=test&id=190603|190629

<button onclick="removeId(190603)">Remove ID</button>
<button onclick="removeId(190629)">Remove ID</button>

How to do when click on button that id be removed from the url address and reload address without ID I've removed?

Answer Source

Just trying... (this was for prev version of question)

document.write('<a href=http://localhost/?page=test&id='+s.replace(new RegExp('(^|[|])'+e+'(?=$|[|])'),'')+'">Remove '+e+' id from url</a><br>')
location.search=<tag color="red">?page=test&amp;id=190603|764583|87436835|846345</tag><br>

Okay, i got some lulz.

Ow, and answer for updated question: Make the same (as above) thing on php

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download