Skip to content

Instantly share code, notes, and snippets.

@davidgg
Created June 17, 2015 10:25
Show Gist options
  • Save davidgg/2b92c94eded1354dee10 to your computer and use it in GitHub Desktop.
Save davidgg/2b92c94eded1354dee10 to your computer and use it in GitHub Desktop.
Get URL Parameters
//From: http://www.jquerybyexample.net/2012/06/get-url-parameters-using-jquery.html
var getUrlParameter = 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];
}
}
return null;
}
//"http://dummy.com/?technology=jquery".
getUrlParamenter('technology'); //'jquery'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment