"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > Understanding POST requests in Javascript

Understanding POST requests in Javascript

Published on 2024-11-06
Browse:132

Understanding POST requests in Javascript

function newPlayer(newForm) {
  fetch("http://localhost:3000/Players", {
      method:  "POST",
      headers: {
        'Content-Type': 'application/json'
      },
      body:JSON.stringify(newForm)
    })
  .then(resp => resp.json())
//   .then(player => console.log(player))
.then(player => showPlayer(player))
}

function showPlayer (player) {
    console.log(player)``

I often remind myself that not all information needs to be refactored. I currently attend a bootcamp and know how difficult it can be to take in loads of information, and the difficulty of time management to keep from getting overwhelmed. I hope this guide helps you to better understand POST requests and was simple and sweet and thanks for the read!

Release Statement This article is reproduced at: https://dev.to/alegendcodes/understanding-post-requests-in-javascript-214p?1 If there is any infringement, please contact [email protected] to delete it
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3