Created
May 2, 2013 05:57
-
-
Save lunaroja/5500398 to your computer and use it in GitHub Desktop.
Simple jQuery plugin that gets URL parameter by name for either address or specific url.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.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, ' ')); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment