getQueryString

Reading QueryString from JS

CodeFunctionName
What is this?

Public

Not Tested

Imported
<script >

function getQueryString() {
var result = {}, queryString = location.search.slice(1),
re = /([^&=]+)=([^&]*)/g, m;
while (m = re.exec(queryString)) {
result[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
}
return result;
}
var myParam = getQueryString()["myParam"];
var queryDict = {}
location.search.substr(1).split("&").forEach(function(item) {queryDict[item.split("=")[0]] = item.split("=")[1]})

</script >

Views 3,506

Downloads 1,367

CodeID
DB ID

ANmarAmdeen
626
Revisions

v1.0

Tuesday
May
29
2018