Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

218
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!