JSFiddle - React, Tailwind, and code Playground
by Town
JavaScript
$(document).ready(function(){ alert(getQueryString()["test"]);});
function getQueryString() {
var result = {}, queryString = location.search.substring(1),
re = /([^&=]+)=([^&]*)/g, m;
while (m = re.exec(queryString)) {
if (typeof result[decodeURIComponent(m[1])] == 'undefined'){
result[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
} else {
if (typeof result[decodeURIComponent(m[1])] == 'string'){
result[decodeURIComponent(m[1])] = [result[decodeURIComponent(m[1])]];
}
result[decodeURIComponent(m[1])].push(decodeURIComponent(m[2]))
}
}
return result;
}