function getGETParameter(paramName) {
window.location.search.substr(1).split('&').forEach(function(element, index) {
if (element.indexOf(paramName) >= 0) {
return element.split('=')[1];
}
});
}
console.log(getGETParameter('search')); // undefined
var result = null;
window.location.search.substr(1).split('&').forEach(function(element, index) {
if (element.indexOf(paramName) >= 0) {
result = element.split('=')[1];
}
});
return result;