ANTON072
5/14/2013 - 12:23 PM

Retrieve the value of a GET parameter using javascript

Retrieve the value of a GET parameter using javascript

function decodeUrlParameter(str) {
	return decodeURIComponent((str+'').replace(/\+/g, '%20'));
}

function getUrlParameter(name) {
	return decodeUrlParameter(decodeURI(
        (RegExp(name + '=' + '(.*?)(&|$)').exec(location.search)||[,null])[1]
    ));
}