How can I send a http delete request from browser?

后端 未结 6 1911
一整个雨季
一整个雨季 2020-12-10 02:01

Is there a way to send a DELETE request from a website, using xmlhttprequest or something similar?

6条回答
  •  北海茫月
    2020-12-10 02:13

    I use fetch API on one of the projects:

    fetch(deleteEndpoint, {
      method: 'delete',
      headers: {'Content-Type': 'application/json'},
      body: JSON.stringify({id: id, token: token})
    })
    

    I have deleteEndpoint, id and token previously defined.

提交回复
热议问题