J
J
Jorlian2020-04-17 22:12:09
JavaScript
Jorlian, 2020-04-17 22:12:09

DELETE request to backend, how to send such request using Fetch?

5e99ff7accde1658914438.png
Been like this

let delTeacher = (id) => {
    teachers.delete(id);
    
    fetch('http://localhost:8080/teachers', {
        method: 'DELETE',
        headers: {
            teacher: id
        } 
    })
};

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2020-04-17
@Rsa97

fetch(url, {method: 'DELETE', ...})

V
Victor L, 2020-04-17
@Fzero0

Have you tried passing id in body? And in the headers type

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question