Skip to content

Instantly share code, notes, and snippets.

@SlyDen
Forked from daniyalzade/getURLParameter.js
Created March 22, 2018 13:15
Show Gist options
  • Save SlyDen/2115aaa8d1781c63c117172c9a1efc16 to your computer and use it in GitHub Desktop.
Save SlyDen/2115aaa8d1781c63c117172c9a1efc16 to your computer and use it in GitHub Desktop.
Get URL parameter in javascript
function getURLParameter(name) {
var val = (RegExp('[?|&]' + name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1];
return val ? decodeURI(val) : val;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment