1const queryString = window.location.search;
2const parameters = new URLSearchParams(queryString);
3const value = parameters.get('key');
1const urlParams = new URLSearchParams(window.location.search);
2const myParam = urlParams.get('myParam');
3
1const urlParams = new URLSearchParams(window.location.search);
2const myParam = urlParams.get('myParam');
1const queryString = window.location.href;
2const parameters = new URLSearchParams(queryString);
3const value = parameters.get('key');
1function getUrlParameter(name) {
2 name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
3 var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
4 var results = regex.exec(location.search);
5 return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
6};
1// Get query string from url
2const href = 'http://localhost:8080/sign-up?ref=devjohndoe'
3const referral_token = new URL(href).search.split('?ref=').pop();
4console.log(referral_token);