Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

222
Vistas
Can I import a variable from the front end script?

I am trying to carry the array of data from one HTML file to another? is that possible and if so how can I do this? Maybe use

here is an example:

First HTML file

<script>
    let tmp = <%- result %>;
    let a = ''
    for (const i in tmp){
        a += tmp[i]['PartitionKey'] + ' ' + tmp[i]['company_name']                
    }
    console.log(a);
    export{ a }
</script>

Second HTML file

<script>
    import { a } from './client.html'
    console.log(a);
</script>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Yes. But you need to use modules. For example, you have two .js files. index.js and index2.js.

Code of index.js

import { a } from './index2.js';

console.log({ a });

Code of index2.js

export const a = 10;

To use modules in js you have to connect index.js to .html page by <script src="index.js" type="module"></script> And it will only work with http server. To run http server locally you can use this package https://www.npmjs.com/package/http-server

about 4 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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda