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

331
Vistas
Reload variables injected in express template

I am building an application with Express that uses the ejs template system. I have a form that contains an input that is built dynamically with the tags variable, in addition, there is a button to add a new Tag, that uses AJAX to do so.

app.ts
app.get('/', async (req: Request, res: Response) => {
  const tags = await TagController.getAllTags();
  res.render('index', { tags });
});
index.ejs
<% tags.forEach((t)=>{ %>
  <div class="tag is-dark">
      <%= t.name %>
  </div>
<% }); %>
<button id="add-tag">Add a new tag!</button>

The problem is that I want this to be added without adding something like location.reload() as the page load is quite large, it worsens the user experience and I should implement a system to manage the state of the form.

I understand that I can do it through Javascript, since I have an endpoint that returns all the tags, but that would lead me to rebuild parts of the interface and stop using the ejs template system.

Is there any way for the injected variable to be reloaded without reloading the page? Or is completely static and the only way to modify it is by the reload?

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