Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
Import html module with JS

New to coding and new to JavaScript.

I have a simple web page where I have a menu with different items (e.g., results, and analysis). When you click on one of the item, say “results”, I want it to display within the same web page (without reloading) a piece of another HTML page containing the results, which is in another file. Why? Because the results content will be too large to write it in the main.js, so the html needs to be loaded from a different HTML file.

I am thinking (but there may be other ways to do it) of importing the results.html with JavaScript with an event listener. But I’m not sure how to do that. With an HTML module?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

There are different approaches for your Problen:

  1. use fetch() to load your data when needed from the server and then render it in to the view.
  2. use a dynmaic import with import(...) and load the whole module including your data and the view

my personal opinion is to go with 1. and just load your data when you need it.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda