」工欲善其事,必先利其器。「—孔子《論語.錄靈公》
首頁 > 程式設計 > 了解 Javascript 中的 POST 請求

了解 Javascript 中的 POST 請求

發佈於2024-11-06
瀏覽:673

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)``

我常常提醒自己,並不是所有的資訊都需要重構。我目前參加了一個訓練營,知道吸收大量資訊是多麼困難,也知道管理時間以防止不知所措是多麼困難。我希望本指南可以幫助您更好地理解 POST 請求,並且簡單明了,感謝您的閱讀!

版本聲明 本文轉載於:https://dev.to/alegendcodes/understanding-post-requests-in-javascript-214p?1如有侵犯,請聯絡[email protected]刪除
最新教學 更多>

免責聲明: 提供的所有資源部分來自互聯網,如果有侵犯您的版權或其他權益,請說明詳細緣由並提供版權或權益證明然後發到郵箱:[email protected] 我們會在第一時間內為您處理。

Copyright© 2022 湘ICP备2022001581号-3