You can directly access the query string with window.location.search
. You can convert it to an object using this regex trick found here.
var queryString = {};
window.location.search.replace(/([^?=&]+)(=([^&]*))?/g, function($0, $1, $2, $3) {
queryString[$1] = $3; }
);
Then set the site_type
on queryString
appropriately.
queryString["site_type"] = "normal";
And finally, convert it back into a string and set that as the window.location.search
.
var searchString = "";
for ( q in queryString ) {
searchString+="&" + q + "=" + queryString[q];
}
window.location.search = searchString;