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

126
Vistas
Form submit to new page with javascript json array data

Use of fetch is very common but it not going to load new page with data, it just send data and receive data.

How to use it like normal HTML form submit but instead of using name I can send data like fetch and but open new link as form action does. Open New Page.

If i use form action I have to use name attribute but there is some much data so name can be too much for it also it can be array also that is hard pass for using name for.

Is it possible to send data like form html but without name that open a new page with all data which get send via.

Only I want to send an array which post to new page as a json data.

<!-- Here is example of using alpine and using fetch to send data it return whole page but i can't do anything with it -->
<script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
<div x-data="{order:''}">
  <form @submit.prevent="fetch('/user/payment', {method: 'POST', headers:{'Content-Type': 'application/json'},body: JSON.stringify(order)})">
    <div class="mt-6">
      <button><span>Proceed to RazorPay<br>₹ 747</span>
      </button>
    </div>
  </form>
</div>

<Br>
<Br>
<!-- I like something Like this so action page but here i like to send array of data -->
  <form method="POST" action= '/user/payment'>
  <input type="text" name="order"/>
    <div class="mt-6">
      <button><span>Proceed to RazorPay<br>₹ 747</span>
      </button>
    </div>
  </form>

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

After using fetch, you can change the url of the window like this window.location.replace = your_url.

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