Skip to content

Instantly share code, notes, and snippets.

@karmanov
Last active August 29, 2015 14:11
Show Gist options
  • Save karmanov/cb420520f307adcb542d to your computer and use it in GitHub Desktop.
Save karmanov/cb420520f307adcb542d to your computer and use it in GitHub Desktop.
Get parameter value from url
function getUrlParameter(sParam) {
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++) {
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam) {
return sParameterName[1];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment