最初の方法:
VAR paramsArray = window.location.search.substr(1).split( '&' )、 I、 paramsObj = {}; paramsArray.forEach(関数(アイテム){ iは item.indexOf( '=' = ); paramsObj [item.slice( 0、I)] = item.slice(I + 1 ); }); console.log(paramsObj)
第二の方法:
関数のGetRequest(){ VARの URL = window.location.search; VAR jsonList = {}; IF - (url.indexOf()> 1 "?" ){ VAR STR = url.slice(url.indexOf() "?" + +1 ); VARのSTR = str.split( "&" ); のため(VAR Iは= 0; I <strs.length; I ++ ){ jsonList [STRの[I] .split( "=")[0] = STRの[I] .split( "=")[1]; // 文字化けしている場合、次に、decodeURIを使用することができる()復号 } } 戻りjsonListを; } コンソール。ログ(のGetRequest())