Skip to content

Instantly share code, notes, and snippets.

@Victa
Created May 23, 2011 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Victa/986844 to your computer and use it in GitHub Desktop.
Save Victa/986844 to your computer and use it in GitHub Desktop.
Get URL parameters
function getUrlParameters(search) {
var search = search ? search : window.location.search;
var vars = {};
if (search.length > 0) {
var hash, hashes = search.slice(1).split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars[hash[0]] = hash[1];
}
}
return vars;
}
// src http://forrst.com/posts/Get_URL_parameters-DnE
@vinch
Copy link

vinch commented May 23, 2011

@Victa
Copy link
Author

Victa commented May 23, 2011

Merci :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment