Skip to content

Instantly share code, notes, and snippets.

@olitomas
Forked from cmatskas/parseUrl.js
Created July 4, 2016 00:04
Show Gist options
  • Save olitomas/ffafd61f96f6fb82f628be69daf9fe22 to your computer and use it in GitHub Desktop.
Save olitomas/ffafd61f96f6fb82f628be69daf9fe22 to your computer and use it in GitHub Desktop.
ParseUrl.js
var parseQueryString = function(url) {
var urlParams = {};
url.replace(
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function($0, $1, $2, $3) {
urlParams[$1] = $3;
}
);
return urlParams;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment