Skip to content

Instantly share code, notes, and snippets.

@zerolab
Created September 18, 2014 09:16
Show Gist options
  • Save zerolab/fff85e4347fdd6532b8e to your computer and use it in GitHub Desktop.
Save zerolab/fff85e4347fdd6532b8e to your computer and use it in GitHub Desktop.
Parse query string
function parseQueryString(queryString) {
var params = {}, queries, temp, i, l;
// Split into key/value pairs
queries = queryString.split("&");
// Convert the array of strings into an object
for ( i = 0, l = queries.length; i < l; i++ ) {
temp = queries[i].split('=');
params[temp[0]] = temp[1];
}
return params;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment