목록자바스크립트,javaScript (4)
studyplan
html 은 이렇게 생겼고 화면엔 이렇게 나오고 ! css 를 이렇게 잡아서 자바스크립트로 , 수정버튼 누르면 display none 을 block 으로 바꾸고 , 빨간색 x 를 누르면 창이 꺼지게 만들었다
저번 포스팅에 이어서 삭제 버튼을 만들어 보겠다 // 삭제버튼 이벤트 $ul.onclick = e => { if (!e.target.matches('.del-btn')) return; const rno = e.target.parentElement.dataset.rno; fetch(url + '/' + rno, { method: 'DELETE' }) .then(res => { if (res.status === 200) { return res.text(); } return null; }) .then(msg => { if (msg === 'del-success') { alert('삭제 성공!'); } else { alert('삭제 실패!'); } }) .catch(err => alert('통신 실패!')) }..
html 구조 ! const boardNo = 300; const url = 'http://localhost:8183/api/v1/replies'; fetch(url + '?boardNo=' + boardNo) .then(res => res.json()) .then(replyMap => { makeReplyDOM(replyMap.replyList); }); ------------------------------------------------------------------------------- fetch(url + '?boardNo=' + boardNo) // http://localhost:8183/api/v1/replies'에 boardNo 인 데이터를 가져옴 then. 그래서 가져온게 res 인데..
const boardNo = 259; const url = 'http://localhost:8183/api/v1/replies'; fetch(url + '?boardNo=' + boardNo) .then(res => res.json()) .then(replyMap => { makeReplyDOM(replyMap.replyList); }); ------------------------------------------------------------------------------- fetch(url + '?boardNo=' + boardNo) // http://localhost:8183/api/v1/replies'에 boardNo 인 데이터를 가져옴 then. 그래서 가져온게 res 인데 res를 json..