Skip to content

Instantly share code, notes, and snippets.

@loadedsith
Forked from lunaroja/jquery.getParam.js
Last active December 19, 2015 21:39
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 loadedsith/6021588 to your computer and use it in GitHub Desktop.
Save loadedsith/6021588 to your computer and use it in GitHub Desktop.
Jquery / Zepto agnostic plugin version of jquery.getParam() for grabbing the parameters out of the uri
;(function($){
$.extend($, {
getParam: function(n,u) {
if(!u) var u = window.location.search;
var match = RegExp('[?&]' + n + '=([^&]*)').exec(u);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
})
})(window.Zepto || window.jQuery)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment