Skip to content

Instantly share code, notes, and snippets.

@akaramires
Created November 20, 2013 08:29
Show Gist options
  • Save akaramires/7559705 to your computer and use it in GitHub Desktop.
Save akaramires/7559705 to your computer and use it in GitHub Desktop.
function getUrlParameters(parameter, staticURL, decode){
var currLocation = (staticURL.length)? staticURL : window.location.search,
parArr = currLocation.split("?")[1].split("&"),
returnBool = true;
for(var i = 0; i < parArr.length; i++){
parr = parArr[i].split("=");
if(parr[0] == parameter){
return (decode) ? decodeURIComponent(parr[1]) : parr[1];
returnBool = true;
}else{
returnBool = false;
}
}
if(!returnBool) return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment