Skip to content

Instantly share code, notes, and snippets.

@purtuga
purtuga / parseParams.js
Last active December 19, 2015 06:39 — forked from can3p/gist:1787188
URL param parsing as generated by jQuery.param. Supports both "legacy" style (ex. foo=bar&foo=bar2&bar=foo) as well as new style (ex. foo[]=bar&foo[]=bar2&bar[]=foo). Original fork did not support legacy style where the key had multiple values. When wanting to parse the document's url, remember to only pass in the document.location.search or doc…
(function(factory){
if (typeof define === "function" && define.amd) {
// AMD. Request jQuery and then run the plugin
define(factory );
} else {
// Global jQuery
window.parseParams = factory();
}
}(function() {