Misafir adlı üyeden alıntı: mesajı görüntüle
<form action="#" method="POST">
    <input type="text" name="username">
    <input type="password" name="password">
    <button type="submit">Gönder</button>
  </form>


  <script>
    const zfc = async (data) => {
      return await new Promise((resolve, reject) => {
        fetch('url', {
          method: 'POST',
          body: data
        }).then(res => res.json())
          .then(res => resolve(res))
          .catch(r=>reject(r))
      })
    }
    var form = document.querySelector('form');
    form.onsubmit =async (e) => {
      e.preventDefault()
      var r = new FormData(form)
      var rt = await zfc(r)
      console.log(rt)
    }
  </script>
işe yaramıyor