var interval = setInterval(function() {
    //로직
    console.log("1초마다 한번씩 콘솔에 출력");
    
    
    //ms기준 1000 = 1초
}, 1000);
    
clearInterval(interval);


사용법: setInterval(실행함수, 주기);


중지방법: setInterval 함수를 변수에 저장하고 clearInterval(변수);

var Table = $('#table').DataTable({
        "destroy": true, //테이블 재생성
"paging": true, //페이징처리
"ordering": true, //칼럼별 정렬기능
"autoWidth": false, //가로자동
"lengthChange": true, //데이터건수 변경
"pageLength": 50, //기본 데이터건수
"lengthMenu": [[50, 100, 1000], [50, 100, "Max(1000)"]], //데이터건수옵션
"order": [15,'desc'], //기본 정렬칼럼
"searching": false, //검색
"scrollX": true, //가로 스크롤
"ajax": function (data, callback, settings) { //ajax 호출
$.ajax({
        url: "data.do",
        data: { params: JSON.stringify({
                            id: id
                        })
                },
        success: function(res) {
//받아온 데이터 조작
//콜백함수에 파라미터 데이터
            callback(res);
        }
    });
},
"columns" : [ //받아온데이터의 이름        //칼럼 클래스
    {"data": "id", "defaultContent": "", "className":"left"},
    {"data": "name", "defaultContent": ""}
    
],
"columnDefs" : [//칼럼조작
//가로길이         //칼럼제목   //데이터타겟    //해당칼럼만 정렬기능사용안함
    {"width":"1em", "title":"ID", "targets":1, "orderable": false},
    {"width":"1em", "title":"Name", "targets":2}
]
})


1
2
3
4
5
6
7
$('#모달ID').on('hidden.bs.modal', function () {
        //모달이 닫힐때 로직
});
 
$('#모달ID').on('show.bs.modal', function () {
       // 모달이 열릴때 로직
});
cs


1
2
3
4
5
6
7
8
9
$('#테이블ID').on("click""button#버튼ID", function() {
        $(this).closest("tr").children().eq(0).text();
        $(this).closest("tr").children().eq(1).text();
        $(this).closest("tr").children().eq(2).text();
        $(this).closest("tr").children().eq(3).text();
        $(this).closest("tr").children().eq(4).text();
        $(this).closest("tr").children().eq(5).text();
        $(this).closest("tr").children().eq(6).text();
});
cs