Last active
August 29, 2015 14:07
-
-
Save mike-zarandona/5818e0c1087b4647c380 to your computer and use it in GitHub Desktop.
Function to check for and return the values of URL parameters.
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
// Get URL parameters | |
function getURLParameter(name) { | |
name = name.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"); | |
var regexS = "[\\?&]"+name+"=([^&#]*)", | |
regex = new RegExp( regexS ), | |
results = regex.exec( window.location.href ) | |
; | |
if( results === null ) { | |
return ''; | |
} | |
else { | |
return results[1]; | |
} | |
} |
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
function getURLParameter(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var b="[\\?&]"+a+"=([^&#]*)",c=new RegExp(b),d=c.exec(window.location.href);return null===d?"":d[1]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment