I am looking to open a new page, but when opening it, a parameter is passed. Example:
file A:
<html>
.....
<script>
var user="mi_nombre_de_usuario";
location.href="/pagina_b"+user;
</scritp>
.....
</html>
So far I have tried several things but I can not get it to open the "pagina_b" and also get a parameter. At the moment I have this code that I found on the internet.
function pasarVariables(pagina, nombres) {
pagina +="?";
nomVec = nombres.split(",");
for (i=0; i<nomVec.length; i++)
pagina += nomVec[i] + "=" + escape(eval(nomVec[i]))+"&";
pagina = pagina.substring(0,pagina.length-1);
location.href=pagina;
}
//location.href="../prueba?hola" ;
pasarVariables("../prueba",username);
}
Any suggestion I would appreciate it.