Skip to content

Instantly share code, notes, and snippets.

@aalfiann
Created May 7, 2021 11:21
Show Gist options
  • Save aalfiann/8475807281609fe55ab8be9336aca210 to your computer and use it in GitHub Desktop.
Save aalfiann/8475807281609fe55ab8be9336aca210 to your computer and use it in GitHub Desktop.
Get URL Parameter
function getUrlParam(url) {
if (url) {
var query = url.split('?');
if (query[1]) {
var data = {};
var queries = query[1].split('&');
for (var i = 0; i < queries.length; i++) {
var item = queries[i].split('=');
data[item[0]] = decodeURIComponent(item[1]);
}
return data;
}
}
return '';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment