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

186
Vistas
I'm trying to send a form data to the server using fetch post method but it doesn't seem to be working
let klantInfo = {
  Voornaam: voornaam,
  Achternaam: achternaam,
  Wachtwoord: myWachtwoord,
  EmailAdres: email,

}


let SendData = (ev) => {
  ev.preventDefault();
  if (inputSucceeded) {
    window.onload = function() {
      postRequest();
    }

    function postRequest() {
      const messageHeaders = new Headers({ // (1)
        'Content-Type': 'application/json'
      })

      fetch(apiUrl, {
          method: 'POST',
          body: JSON.stringify(klantInfo),
          headers: messageHeaders
        })
        .then(function validateResponse(res) {
          return res;
        })
        .then(function readResponseAsText(response) {
          return response;
        })
        .then(function logResult(result) {
          return result;
        })
        .catch(function logError(error) {
          return error;
        });
    }

    function readResponseAsText(response) {
      console.log(response.text()); // (1)
    }
  } else {
    alert("Niet alle tekst zijn gevuld");
    return;
  }
}
btnRegisteren.addEventListener('click', SendData)
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