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

354
Visualizações
Is there a simple way to perform the equivalent of a PHP include() in Javascript?

I have several forms pages which share some of the same fields. These field-sets have been turned into reusable code modules and are imported into each page's DOM using PHP require() statements.

These field-sets have corresponding jQuery event handlers which perform field validation as well as miscellaneous UI-related tasks. I would like to make these handlers reusable, as well.

Previously, I've always declared such handlers within the $(document).ready() event.

If I'm going to import these handlers from an external file, it is my understanding they still need to be included directly into the $(document).ready() event, rather than imported using a standard HTML <script> tag pair.

In PHP, I'd simply include() or require() the code block like I do with the field-sets. How do I perform the equivalent in JS as simply as possible? Preferably without adding yet another framework, I might add.

about 4 years ago · Juan Pablo Isaza
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