[jsp] ajax으로 data 조회하고 push 이용해서 바꾸기
<%-- 리스트 가져오기 --%>
var boardArrayList = [];
function getItemList() {
boardArrayList = [];
$.ajax({
type: "POST",
url: "",
data: $("#itemlistfrm").serialize(),
dataType: "json",
cache : false,
async : false,
success: function(data) {
var rows = data.rows;
var htmlTemp = '';
if(rows.length==0) {
$("#itemList").remove();
} else {
var cnt = 0;
for(var i=0;i<rows.length;i++) {
htmlTemp = htmlTemp + "
+"
+"
+"
+"
+"
";
boardArrayList.push({
idx :rows[i].idx
,hd_code :rows[i].hd_code
,dt_code :rows[i].dt_code
,qna_dsc :rows[i].qna_dsc
,title :rows[i].title
,content :rows[i].content
,writer_id :rows[i].writer_id
,notify_cellphone :rows[i].notify_cellphone
,notify_sms_yn :rows[i].notify_sms_yn
,atch_file_name :rows[i].atch_file_name
,atch_svr_file_name :rows[i].atch_svr_file_name
,atch_file_size :rows[i].atch_file_size
,reg_day :rows[i].reg_day
,reply_yn :rows[i].reply_yn
,reply_day :rows[i].reply_day
,reply_for_idx :rows[i].reply_for_idx
,hitcnt :rows[i].hitcnt
,use_flag :rows[i].use_flag
});
}
$("#itemList").html(htmlTemp);
}
$("#pageNo").html(data.pagingHtml);
if(rows.length==0) {
} else {
btnInit();
getItemView('0');
}
},
error:function(response) {
alert('error');
}
});
return false;
}
<%-- 상세보기 --%>
function getItemView(value1) {
contentView(
boardArrayList[value1].idx
,boardArrayList[value1].hd_code
,boardArrayList[value1].dt_code
,boardArrayList[value1].qna_dsc
,boardArrayList[value1].title
,boardArrayList[value1].content
,boardArrayList[value1].writer_id
,boardArrayList[value1].notify_cellphone
,boardArrayList[value1].notify_sms_yn
,boardArrayList[value1].atch_file_name
,boardArrayList[value1].atch_svr_file_name
,boardArrayList[value1].atch_file_size
,boardArrayList[value1].reg_day
,boardArrayList[value1].reply_yn
,boardArrayList[value1].reply_day
,boardArrayList[value1].reply_for_idx
,boardArrayList[value1].hitcnt
,boardArrayList[value1].use_flag
);
getAnswerBoardList(boardArrayList[value1].idx);
}
[jsp] ajax으로 data 조회하고 push 이용해서 바꾸기
'programming > jsp' 카테고리의 다른 글
[jsp] ajax data (0) | 2019.02.25 |
---|---|
swiper 슬라이더 참고 (0) | 2018.07.27 |
[jsp] 구글 지도 embed 약도 찾아오는길 넣기 (0) | 2018.07.05 |
[웹폰트] 본고딕 웹폰트 적용하기 (0) | 2018.01.22 |
[jsp] jsp 파일 변경 (0) | 2017.09.25 |