$(document).ready(function(){ const authSopmalCd = getCookie("authSopmalCd"); $.ajax({ url: '/mngr/alarm/select/selectAlarmCount', method: 'GET', contentType: 'application/json; charset=UTF-8', data: {"sopmalCd" : authSopmalCd}, success: function(data) { if (data.resBody && data.resBody.result) { let parseResult = JSON.parse(data.resBody.result); let status = parseResult.status; if (status === 'success') { console.log(parseResult.refundList); console.log(parseResult.answerList); show_top_menu_req_cnt(parseResult.refundList); show_top_menu_req_cnt(parseResult.answerList); } } }, error: function(xhr, status, error) { } }); }); function show_top_menu_req_cnt(list) { if(list.length < 1) return; let menu = list[0].menuName; $("div.header-nav__right a").each(function () { if ($(this).text() == menu) { if ($(this).text() == '게시판') { for (var i = 0; i < list.length; i++) { let bbsId = list[i].bbsId; let cnt = list[i].cnt; if (bbsId == 'goods_qna') { $(this).parent().append("
" + cnt + "
"); } else { $(this).parent().append("
" + cnt + "
"); } } } else { if (list[0].cnt != 0) { $(this).parent().append("
" + list[0].cnt + "
"); } } } }); } function getCookie(name) { const value = `; ${document.cookie}`; const parts = value.split(`; ${name}=`); if (parts.length === 2) return parts.pop().split(';').shift(); }