去掉url中的某个参数(正则)
var s1 = s.replace(/[\?&]+"替换的参数名"+=[^&]*&?$/g, "");
var url = window.location.href;
var new_url = "";
var par = "";
if (url.split("request_locale").length > 1) {
var temp = url.split("request_locale");
par = temp[1];
if (par.split("&").length > 1) {
var par2 = par.split("&")[0]+"&";
par = par.replace(par2, "");
}else{
par = "";
}
new_url = temp[0] + par;
}else{
new_url = url;
}
if (new_url.split("?").length > 1) {
if (new_url.charAt(new_url.length - 1)=="&" || new_url.charAt(new_url.length - 1)=="?") {
new_url += "request_locale=" + $("#queryVehicleType").val();
}
}
else {
new_url += "?request_locale=" + $("#queryVehicleType").val();
}
window.location.href = new_url;