I have this function in javascript and need to ignore the whitespace of the string. I think the function is removing the "blank spaces". Does anyone know how to use this same function without removing the blanks?
function getParameterByName(name) {
if (name !== "" && name !== null && name != undefined) {
name = name.replace(/[\[]/, "\[").replace(/[\]]/, "\]");
var regex = new RegExp("[\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace("/\+/g", " "));
} else {
var arr = location.href.split("/");
return arr[arr.length - 1];
}
}