DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

I am a tech curator at DZone, and I am always looking for interesting stories to read and post. Ross has posted 64 posts at DZone. You can read more from them at their website. View Full User Profile

Get URL Parameters

05.17.2012
| 4670 views |
  • submit to reddit
function getURLParameter(name){
  return decodeURI(
    (RegEXP(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
  );
}
This function takes the name of your parameter as a string and returns it's value as set in the current URL.