[javascript] post form data with fetch api?

Posted in :

想透過 javascript 取得使用 post 的網頁裡的內容, 解法:
https://stackoverflow.com/questions/46640024/how-do-i-post-form-data-with-fetch-api

let formData = new FormData();
formData.append('name', 'John');
formData.append('password', 'John123');
fetch("http://localhost:8080/your/server",
    {   method: 'POST',
        body : formData
    })
    .then(function(response) {
      return response.text()
    }).then(function(text) {
        //text is the server's response
    });

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *