Skip to content

Instantly share code, notes, and snippets.

@Develer
Created October 8, 2014 10:03
Show Gist options
  • Save Develer/58c89aec210360524e15 to your computer and use it in GitHub Desktop.
Save Develer/58c89aec210360524e15 to your computer and use it in GitHub Desktop.
function getQueryParams() {
var href = window.location.href.split("?");
var queryParams = {};
if (href.length > 1) {
var queryString = href[1];
if (queryString) {
queryString = decodeURIComponent(queryString);
var rawParams = queryString.split("&");
$.each(rawParams, function(i, val) {
var temp_param = val.split("=");
if (temp_param[1].split(',').length > 1) {
temp_param[1] = temp_param[1].split(',');
}
queryParams[temp_param[0]] = temp_param[1];
});
}
}
return queryParams;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment