21 lines
554 B
JavaScript
21 lines
554 B
JavaScript
document.addEventListener('DOMContentLoaded', async () =>{
|
|
await getParams();
|
|
})
|
|
|
|
async function getParams() {
|
|
const queryString = window.location.search;
|
|
const params = new URLSearchParams(queryString);
|
|
const paramsObject = {};
|
|
for (const key of params.keys()) {
|
|
if (key.endsWith('[]')) {
|
|
|
|
const cleanKey = key.replace('[]', '');
|
|
paramsObject[cleanKey] = params.getAll(key);
|
|
} else {
|
|
|
|
paramsObject[key] = params.get(key);
|
|
}
|
|
}
|
|
|
|
return paramsObject;
|
|
} |