Skip to content

Instantly share code, notes, and snippets.

@dhigginbotham
Created November 25, 2014 17:30
Show Gist options
  • Save dhigginbotham/caa1dd30fbd1383897df to your computer and use it in GitHub Desktop.
Save dhigginbotham/caa1dd30fbd1383897df to your computer and use it in GitHub Desktop.
function parseQueryString() {
var params = {}, queries, temp, i, l;
var query = window.location.search;
var queryString = query.substring( query.indexOf('?') + 1 );
// 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