Obtener params js
// www.example.com/users?token=12345
let params = (new URL(document.location)).searchParams;
let token = params.get("token");
// 12345
Lucas Juan
// www.example.com/users?token=12345
let params = (new URL(document.location)).searchParams;
let token = params.get("token");
// 12345
function getSearchParameters() { var prmstr = window.location.search.substr(1); return prmstr != null && prmstr != "" ? transformToAssocArray(prmstr) : {}; } function transformToAssocArray( prmstr ) { var params = {}; var prmarr = prmstr.split("&"); for ( var i = 0; i < prmarr.length; i++) { var tmparr = prmarr[i].split("="); params[tmparr[0]] = tmparr[1]; } return params; } var params = getSearchParameters();