// 전체선택 갱신 $(document).on('change', '#chkAll', function () { $('input[type="checkbox"].list-check-box').prop('checked', this.checked); }); // 선택삭제 $(document).on("click", "#btnAccountCommentDelete", function(e) { comment.delete(); }); // 목록 보기 갯수 $(document).on("change", "select#perPage", function (e) { comment.setPerPage(e); }); var comment = { delete: function() { let $list = $('input[type="checkbox"].list-check-box:checked'); if($list.length <= 0) { alert("삭제할 게시글을 선택해 주세요."); return false; } if(confirm("정말 삭제하시겠습니까?")) { let keys = []; $list.each(function(i, row) { keys.push(row.value); }); $.ajax({ url: (BASE_URL + "/account/comment/delete"), type: 'DELETE', dataType: 'JSON', data: { keys: keys, }, success: function (res) { if (!res.success) { alert(res.message); } }, error: function () { alert("잘못된 요청입니다."); } }).done(function() { location.reload(); }); } }, setPerPage: function(e) { let form = document.getElementById("fAccountComment"); form.per_page.value = e.target.value; form.submit(); } }