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

165
Views
How to get form data using POST method and fetch api?

I wanted help to get data from post method using fetch api? I tried the below code but can anyone help me understand how to work on it?

The script.js file as below,

//select the elements
const submitBtn = document.getElementById("submit");

//get data from the form
const formData = submitBtn.addEventListener('click', function (info) {
    fetch(info)
        .then((response) => {
            console.log(response);
            return response.json();
        })
        .then((data) => {
            let datas = data;

            datas.map(function (data) {
                const node = document.createElement('li');
                const textNode = document.createTextNode(`${author.blog}`);
                node.appendChild(textNode);
                console.log(node);
            })
        })
        .catch(function (error) {
            console.log(error);
        })
});

HTML in short:

 <form method="post">
<button type="submit" onSubmit="formData" class="btn btn-primary" id="submit">Submit</button>
about 4 years ago · Santiago Gelvez
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!