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

355
Vistas
How to redirect a user based on a returned HTML form response?

I have a HTML form that submits a POST request to a Nelify serverless function. The serverless function does some processing and then returns a URL.

I'm using a HTML form to call the Nelify serverless function because using a JavaScript fetch was throwing a CORS error. The HTML form does not.

The HTML of the form looks like this:

<html>
  <head>
  </head>
  <body>
    <form action="https://www.example.com/.netlify/functions/stripe-create-checkout-session" method="POST">
      <input type="hidden" name="priceId" value="price_1JZS_EXAMPLE" />
      <button id="stripe-btn" type="submit">Checkout Test Starter Plan</button>
    </form>
  </body>
</html>

Screenshot of the HTML form (just the button is visible):

enter image description here

When a response is received the page is changed in place, and the HTML of the form changes to look like this:

<html>
  <body>
    <pre>{"url":"https://checkout.stripe.com/pay/cs_test_a1XZXYz2N8iS46oPtgZUsCFqe434u1c76D5MQrGkNeIW0yjEHbs0oYAx3h#fidkdWxOYHwnPyd1blpxYHZxWjA0T18xUTxGNGFBQjNSZEhXcX0xQH9QcExWRGxwNVRoT39gfDA0f1d3UUM3f0ByQT12Z0IyfXBKbTVVb05jUnFnNlxqf3Y9bl9XMUJWPWlqanR3RD0wVVRUNTU0UH13TDBHRCcpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl"}
    </pre>
  </body>
</html>

And here is a screenshot of how that looks on the page:

enter image description here

With all that said, I have two questions:

  1. How do I grab the url in the reponse and redirect the user to that page? I know this requires JavaScipt but I'm not sure what that should be.
  2. I do not want the response to be rendered on the page. How do I stop it from showing to the user? Perhaps the redirect will hide this?
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you want to just grab the URL then follow the tutorial on w3schools here

https://www.w3schools.com/jsref/prop_doc_url.asp

and if you want to redirect after grabbing the URL then here is the tutorial.

https://www.w3schools.com/howto/howto_js_redirect_webpage.asp

and if we want url in response see this.

Get response of url in nodejs (express/http)

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