Skip to content

Instantly share code, notes, and snippets.

@arbaaz
Created February 4, 2014 06:51
Show Gist options
  • Save arbaaz/8799175 to your computer and use it in GitHub Desktop.
Save arbaaz/8799175 to your computer and use it in GitHub Desktop.
get_url_params_jquery.js
function getUrlParams() {
var paramMap = {};
if (location.search.length == 0) {
return paramMap;
}
var parts = location.search.substring(1).split("&");
for (var i = 0; i < parts.length; i ++) {
var component = parts[i].split("=");
paramMap [decodeURIComponent(component[0])] = decodeURIComponent(component[1]);
}
return paramMap;
}
var params = getUrlParams();
console.log(location.search);
v1=params.document;
console.log(v1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment