Possible Duplicate:
Change URL parameters with jQuery?
Currently, I have a <div>
tag that looks like a button and changes the URL with an onClick function which redirect to the same page just adds &view_all=Yes
or &view_all=No
to the URL.
<div onclick="javascript:window.location.href = 'page.php?action=list-volunteer-apps&view-all=No';">Hide Closed Applications</div>
Well, I am adding a new feature to the website and I need to be able to append that &view_all=Yes
or &view_all=No
to the end of the URL instead of redirecting them because I'll have other variables in the URL that I can't lose.
I have figured out a way to do the append but it keeps adding the &view_all
variables to the end of URL so it looks like this page.php?action=list-volunteer-apps&view-all=No&view_all=Yes&view_all=No
.
This is the way I am doing the append:
onclick="javascript:window.location.assign(window.location.href+='&view-all=No');"