Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Tags more
Archives
Today
Total
관리 메뉴

기분좋음

게시판 ajax 입력 번호값 보내는 방법 본문

IT 기술노트/Spring

게시판 ajax 입력 번호값 보내는 방법

기분좋음:) 2022. 8. 31. 14:14
반응형

function viewList(){
$.ajax({
type : "GET",
url : "/board/ajaxList",
dataType : 'json',
success : function(data) {
if(data.length > 0) {

var html = "<table class = 'table table-striped'>";
html += "<tr>";
html += "<th>번호</th>";
html += "<th>제목</th>";
html += "<th>작성자</th>";
html += "<th>날짜</th>";
html += "</tr>";

$.each(data, (index, data)=>{
html += "<tr>";
html += "<td>"+data.boardNo+"</td>";
html += "<td><a href='/board/boardDetail?boardNo=${data.boardNo}')>"+data.boardTitle+"</a></td>";
html += "<td>"+data.boardName+"</td>";
html += "<td>"+data.regdate+"<button type='button' class='btn btn-danger' onclick='delBoard("+data.boardNo+")'>삭제 </button></td>";
html += "</tr>";
})
html+="</table>";

$(".wrap").html(html);
    }
    }

       });
}

 

 

function delBoard(boarNo){
console.log("ggggg");
console.log("boarNo=="+boarNo);
var result = confirm("삭제하시겠습니까?");

if(result){
alert("확인을 눌렀다");
$.ajax({
type : "POST",
data
url : "/board/ajaxDelete",
success: function(data) {
if(data == "Y") {
location.href = "/board/ajaxList";
}
},
error: function(data){
alert("실패");
}


});


 }
}

반응형

'IT 기술노트 > Spring' 카테고리의 다른 글

스프링 개발 환경설정  (0) 2022.03.24