-
-
Save edm00se/abae980afeda1b2086d9581b36e24f99 to your computer and use it in GitHub Desktop.
for the "signs of an advancing web" blog post https://edm00se.io/web/sings-of-the-web-advancing
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
const parm = new URLSearchParams(window.location.search); | |
console.log(parm.get('foo')); // 'bar' |
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 getQueryParam(searchKey){ | |
var qs = window.location.split('?')[1]; | |
var parmAr = qs.split('&'); | |
var parm = {}; | |
for(i = 0; i<parmAr.length; i++) { | |
var cur = parmAr[i].split('='); | |
var key = cur[0]; | |
var val = cur[1]; | |
parm[key] = val; | |
} | |
return parm[searchKey]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment