Skip to content

Instantly share code, notes, and snippets.

@motsu0
Last active September 20, 2020 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save motsu0/685dbb72760d49a9b2b00a6613f7e5c3 to your computer and use it in GitHub Desktop.
Save motsu0/685dbb72760d49a9b2b00a6613f7e5c3 to your computer and use it in GitHub Desktop.
function get_params1(){
let params = {};
if(location.search!=''){
location.search.replace('?','').split('&').forEach(str=>{
const kv = str.split('=');
params[kv[0]] = decodeURI(kv[1]);
});
}
output_query1(params);
}
function output_query1(params){
output[0].textContent = '';
let str = '{<br>';
for(let key in params){
str += `&ensp;&ensp;${esc_html(key)}: "${esc_html(params[key])}",<br>`;
}
str += '}';
str = str.replace(',<br>}','<br>}');
output[0].innerHTML = str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment