test.html ( getJSON() 이용 ) > SPRINGBOOT

본문 바로가기
사이트 내 전체검색

SPRINGBOOT

test.html ( getJSON() 이용 )

페이지 정보

profile_image
작성자 관리자
댓글 0건 조회 28회 작성일 24-06-13 10:09

본문

<!DOCTYPE html>

<html xmlns:th="http://www.thymeleaf.org"

      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"

      layout:decorate="~{include/layout.html}">

<body>

<div layout:fragment="content">


<br>

<center>

<h1>AJAX TEST</h1>


Total : <span id="total_conunt"></span>

<br>

</center> 


<script th:inline="javascript">

var bno = 20; // t_board에서 존재하는 boardIdx값 입력


$.getJSON("/replies/all/"+bno,

function(data){

$("#total_conunt").text(data.length); //리스트 갯수

}

);

</script>


</div> 

</body>

</html>



<!--

==== 설명 ====

@RestController의 경우 객체를 JSON 방식으로 전달하기 때문에 jQuery를 이용해서 호출할 때는 getJSON()을 이용합니다. 

console에서 data.length가 출력되는 것을 확인할 수 있다.

-->

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

사이트 정보

공지사항
자유게시판
질문답변
1:1문의

 

별명 : 터푸가위
주소 : 부산시 동래구 명장로20번길 90
대표 : 박규태
메일 : dancepkt@******.com

접속자집계

오늘
383
어제
217
최대
10,760
전체
276,130
Copyright © dancePKT . All rights reserved.