728x90
PUT
//PUT - 데이터 수정
fetch("https://jsonplaceholder.typicode.com/posts/1", {
method: "PUT",
body: JSON.stringify({
id: 1,
title: "foo",
body: "bar",
userId: 1,
}),
headers: {
"Content-type": "application/json; charset=UTF-8",
},
})
.then((response) => response.json())
.then((json) => console.log(json));
참고자료
'자바스크립트' 카테고리의 다른 글
Javascript, cookie에서 csrftoken 값 가져오기 (0) | 2022.07.27 |
---|---|
frontend, pipe에러 해결 (0) | 2022.07.25 |
Javascript, fetch FormData (0) | 2022.07.21 |
Javascript, fetch POST (0) | 2022.07.21 |
Javascript, fetch GET (0) | 2022.07.21 |