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

104
Vistas
How to make express app not change page on POST request

I have the following HTML form:

<form method="POST" action="/api/submit_agent">
    <label for="agent_type">Choose an agent model:</label>
    <select name="agent_type">
      <option value="male_agent" selected>Male Agent</option>
      <option value="female_agent">Female Agent</option>
    </select>
    <input id="submit_agent"type="submit" value="Submit">
</form>

and I want to process the form's fields on my nodejs server like so (i'm using express)

app.post("/api/submit_agent", (req, res) => {
  // do stuff
});

but when I submit my form I get redirected to /api/submit_agent. Is there a way to have this processing not reflect in the browser aka without any type of redirection?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

It's not an express thing, just apart of how forms operate in HTML.

You can look at this answer which is similar: Prevent redirect after form is submitted

Just make your post request via js instead of a submit action of your form.

over 4 years ago · Santiago Trujillo 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