the first method:
var paramsArray = window.location.search.substr(1).split('&'), i, paramsObj = {}; paramsArray.forEach(function(item){ i = item.indexOf('='); paramsObj[item.slice(0, i)] = item.slice(i+1); }); console.log(paramsObj)
The second method:
function getRequest () { var URL = the window.location.search; var jsonList = {}; IF - ( "?" url.indexOf ()>. 1 ) { var "?" STR = url.slice (url.indexOf () + 1'd ); var STRs = str.split ( "&" ); for ( var I = 0; I <strs.length; I ++ ) { jsonList [STRs [I] .split ( "=") [0]] = STRs [I] .split ( "=") [. 1]; // if garbled, then, can be used decodeURI () decodes } } return jsonList; } Console.log(getRequest())