I've got a dropdown menu on my form, which when something is selected I need to reload the current page, but with an appended querystring.
How would I go about doing this?
This is an old question but it came up first in google search results.
The solution I went with is similar to jAndy's.
window.location.pathname
gives me the page's url without the query string. I'm then able to build the query string with "?"+$.param({'foo':'bar','base':'ball'})
which I then append to the pathname and set to window.location.href
.
window.location.href = window.location.pathname+"?"+$.param({'foo':'bar','base':'ball'})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With