Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

270
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!