• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

293
Vistas
How do I get a variable from one function on a js file and use it for another function on another js file?

enter image description here

I would like to get the var username, and use it in:

enter image description here

I just need to find a way to append the var username from thee function loginMe(), to user_url, so that I can retrieve data from mysql.

about 3 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There are no way to get variable value from one function to another unless you pass it by parameter or set it as global variable.

When executing loginMe(). You can pass value by calling getUserInfo( username ). Or when you are executing loginMe() you can set username in localStorage and get it in getUserInfo() function from localStorage. Or You can set the value as global variable by window.username then you will be able to access it.

about 3 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda