[Jquery] 새로고침 없이 원하는 부분만 reload 하기

NAEMAMDAEROG·2021년 11월 26일
0
$('#head_review').load(`/book/${res['book_id']} .show_comment`);
  • id='head_review'인 div tag 안에 class='show_comment'인 div tag가 있다.
  • class='show_comment'인 div tag는 리뷰 댓글이 보여지는 부분이다.
  • 나는 댓글 등록하기 버튼을 눌렀을 때 reload 없이 등록한 댓글이 보이길 원했다.
  • 저 코드는 id='head_review'인 곳에 url이 /book/${res['book_id']이 html에서 class='show_comment'인 곳의 내용만 가지고 와서 넣어준다는 의미이다.
  • reload 없이 댓글이 업로드 되는 걸 볼 수 있다.
profile
Blockchain & Programming 공부 기록

0개의 댓글