Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

269
Visualizações
When I POST from Nodejs to an API run on Django rest framework. It returns 200 ok but in database nothing saved
  1. When I POST from Nodejs to an API run on Django rest framework. It returns 200 ok but in database nothing saved. 2.The Api Calls here is run on Django restframework.

  2. The Database used--> Postgres

  3. snippet: js Then html

     function handleSubmit(event) {
       event.preventDefault();
       var x = document.getElementById('Date');
       var y = x.value;
       document.getElementById('Date').value = y;
       if (x != y) {
       x = document.getElementById('Date');
       y = x.value;
       console.log(y);
       const data = document.getElementById('form');        
       fetch('http://127.0.0.1:8000/sender', {
       method: 'POST', // or 'PUT'
       headers: {
       'Content-Type': 'application/json',
       },
       body: JSON.stringify(data),
       }).then(response => response.json()).then(data => {
       console.log('Success:', data);
       }).catch((error) => {
       console.error('Error:', error);
       });
       } else {
       x = document.getElementById('Date');
       y = x.value;
       console.log(y);
       }
       }
    
       const form = document.querySelector('form');
       form.addEventListener('submit', handleSubmit);
    
      <form id="form">
             <label for="SenderId">Your Id:</label>
             <input type="text" name="SenderId" id="id"> <br>
             <label for="SenderName">Your Name:</label>
             <input type="text" name="SenderName" id="SenderName"> <br>
             <label for="SenderAddress">Your Address:</label>
             <input type="text" name="SenderAddress" id="SenderAddress"> <br>
             <label for="SenderPO">Your PO:</label>
             <input type="text" name="SenderPostOffice" id="SenderPostOffice"> <br>
             <label for="Date">Date:</label>
             <input type="date" name="Date" id="Date">
             <label for="PackageCount">Package Count:</label>
             <input type="text" name="PackageCount" id="PackageCount"> <br>
             <button type="submit">Send</button>
         </form>
       <!-- end snippet -->
    
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda