Skip to content

Instantly share code, notes, and snippets.

@remy
Created December 15, 2009 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remy/256811 to your computer and use it in GitHub Desktop.
Save remy/256811 to your computer and use it in GitHub Desktop.
getQuery
function getQuery(s) {
var query = {};
s.replace(/\b([^&=]*)=([^&=]*)\b/g, function (m, a, d) {
if (typeof query[a] != 'undefined') {
query[a] += ',' + d;
} else {
query[a] = d;
}
});
return query;
}
getQuery(window.location.search)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment