Created
October 8, 2014 10:03
-
-
Save Develer/58c89aec210360524e15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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