get params js
// www.example.com/users?token=12345
let params = (new URL(document.location)).searchParams;
let token = params.get("token");
// 12345let params = {};
window.location.search.slice(1).split('&').forEach(elm => {
if (elm === '') return;
let spl = elm.split('=');
const d = decodeURIComponent;
params[d(spl[0])] = (spl.length >= 2 ? d(spl[1]) : true);
});
// https://example.com/?foo=bar&best%20food=D%C3%B6ner
params['foo'] // bar
params['best food'] // Döner
Also in JavaScript:
- javascript sendredirect
- behaviorsubject in angular 10
- angular material remove outline
- what is code.jquery integrity crossorigin
- how to add objects in array in javascript
- javascript moeda reais
- go to another page javascript
- javascript select all table rows
- javascript two character integer
- react pass parameter to component
- parameters types in javascript
- extract all link with javascript
- settimeout jquery
- from json timestamp to date python
- jquery external script
- useeffect react
- [Design System React] App element is not defined. Please use Settings.setAppElement(el)
- args slice discord.js
- button is not calling js function
- jquery wrap inner text
- js vue array change position
- install swagger ui
- displaying the date react
- javascript remove element