jQuery/Javascript – reload current page with an appended querystring?

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'})

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)