var pageAction =
{
        // 고객 추출
  getCustomerList : function()
     {
   if (pageAction.validation() == false) return;
   
         var jsonObj = {};

         jsonObj.city = $.trim(frmPopUp.city.value);
         jsonObj.town = $.trim(frmPopUp.town.value);
         jsonObj.village = $.trim(frmPopUp.village.value);
         jsonObj.apartmentName = $.trim(frmPopUp.apartmentName.value);
         jsonObj.selectBlock = $.trim(frmPopUp.selectBlock.value);
         jsonObj.selectUnit = $.trim(frmPopUp.selectUnit.value);
        
         jsonObj.nowPage  = _nowPage; // 현재 페이지
        
         if(SESSION_INFO.listCount == null || SESSION_INFO.listCount == "")
             jsonObj.listCount  = 10;                                // 리스트 목록 갯수 공통 사용
         else
             jsonObj.listCount  = parseInt(SESSION_INFO.listCount);      // 리스트 목록 갯수 공통 사용

         $.ajax(
         {
             type       : "POST",
             url        : "${pageContext.request.contextPath}/select/Campaign.getCampaignCustomerList/action.do",
             dataType   : "json",
             data       : {"param" : JSON.stringify(jsonObj)},
             async      : false,
             beforeSend : function(xhr)
             {
                 // 전송 전 Code
             },
             success    : function(result)
             {
                 $("#tbDataRow").empty().append("");

                 for (var i=0; i<result.length; i++)
                 {
                     var htmlString = "";

                     htmlString += "<tr>";
                    
                     // 지역 (시도, 시군구, 읍면동)
                     htmlString += "<td class='text_left'>" + result[i].city + " " + result[i].town + " " + result[i].village + "</td>";

                     // 아파트
                     htmlString += "<td class='text_left'>" + result[i].apartmentName + "</td>";
                    
                     // 동
                     htmlString += "<td class='text_left'>" + result[i].block_ + "</td>";
                    
                     // 호수
                     htmlString += "<td class='text_left'>" + result[i].unit_ + "</td>";
                    
                     // 삭제
                     htmlString += "<td class='text_center'><button type='button' class='btn_common' onClick='pageAction.deleteLine(this);'>삭제</button></td>";

                     htmlString += "</tr>";

                     $("#tbDataRow").append(htmlString);
                 }

                 if (result.length > 0) _pageNavi.setPageNumber(result[0].totalPage, "pageAction.getCustomerList()"); // 페이지네비 생성
             },
             error      : function(xhr)
             {
                 // Error 발생 Code
                 alert(xhr.responseText);
             }
         });
     },
    
     // 필수 입력 체크
        validation : function()
        {
            if ($.trim(frmPopUp.city.value) == "")
            {
                alert("'지역선택의 시도'을 선택하여 주십시오.");
                frmPopUp.city.focus();
                return false;
            }

            if ($.trim(frmPopUp.town.value) == "")
            {
                alert("'지역선택의 시군구'를 선택하여 주십시오.");
                frmPopUp.town.focus();
                return false;
            }
           
            if ($.trim(frmPopUp.village.value) == "")
            {
                alert("'지역선택의 읍면동'을 선택하여 주십시오.");
                frmPopUp.village.focus();
                return false;
            }

            return true;
        },
       
        // 테이블 tr 라인 삭제
        deleteLine : function(obj)
        {
         var tr = $(obj).parent().parent();
        
         //라인 삭제
         tr.remove();
        }
};

'IT > jquery' 카테고리의 다른 글

table 안의 라디오버튼 하나씩 체크  (0) 2016.12.15
file 등록 후 img 미리보기  (0) 2016.12.14
콤보박스 텍스트 값  (0) 2015.11.20
div 태그에 html 태그 적용  (0) 2015.04.29
동적 html 컨트롤 찾기  (0) 2015.03.04

+ Recent posts

var pageAction =
{
        // 고객 추출
  getCustomerList : function()
     {
   if (pageAction.validation() == false) return;
   
         var jsonObj = {};

         jsonObj.city = $.trim(frmPopUp.city.value);
         jsonObj.town = $.trim(frmPopUp.town.value);
         jsonObj.village = $.trim(frmPopUp.village.value);
         jsonObj.apartmentName = $.trim(frmPopUp.apartmentName.value);
         jsonObj.selectBlock = $.trim(frmPopUp.selectBlock.value);
         jsonObj.selectUnit = $.trim(frmPopUp.selectUnit.value);
        
         jsonObj.nowPage  = _nowPage; // 현재 페이지
        
         if(SESSION_INFO.listCount == null || SESSION_INFO.listCount == "")
             jsonObj.listCount  = 10;                                // 리스트 목록 갯수 공통 사용
         else
             jsonObj.listCount  = parseInt(SESSION_INFO.listCount);      // 리스트 목록 갯수 공통 사용

         $.ajax(
         {
             type       : "POST",
             url        : "${pageContext.request.contextPath}/select/Campaign.getCampaignCustomerList/action.do",
             dataType   : "json",
             data       : {"param" : JSON.stringify(jsonObj)},
             async      : false,
             beforeSend : function(xhr)
             {
                 // 전송 전 Code
             },
             success    : function(result)
             {
                 $("#tbDataRow").empty().append("");

                 for (var i=0; i<result.length; i++)
                 {
                     var htmlString = "";

                     htmlString += "<tr>";
                    
                     // 지역 (시도, 시군구, 읍면동)
                     htmlString += "<td class='text_left'>" + result[i].city + " " + result[i].town + " " + result[i].village + "</td>";

                     // 아파트
                     htmlString += "<td class='text_left'>" + result[i].apartmentName + "</td>";
                    
                     // 동
                     htmlString += "<td class='text_left'>" + result[i].block_ + "</td>";
                    
                     // 호수
                     htmlString += "<td class='text_left'>" + result[i].unit_ + "</td>";
                    
                     // 삭제
                     htmlString += "<td class='text_center'><button type='button' class='btn_common' onClick='pageAction.deleteLine(this);'>삭제</button></td>";

                     htmlString += "</tr>";

                     $("#tbDataRow").append(htmlString);
                 }

                 if (result.length > 0) _pageNavi.setPageNumber(result[0].totalPage, "pageAction.getCustomerList()"); // 페이지네비 생성
             },
             error      : function(xhr)
             {
                 // Error 발생 Code
                 alert(xhr.responseText);
             }
         });
     },
    
     // 필수 입력 체크
        validation : function()
        {
            if ($.trim(frmPopUp.city.value) == "")
            {
                alert("'지역선택의 시도'을 선택하여 주십시오.");
                frmPopUp.city.focus();
                return false;
            }

            if ($.trim(frmPopUp.town.value) == "")
            {
                alert("'지역선택의 시군구'를 선택하여 주십시오.");
                frmPopUp.town.focus();
                return false;
            }
           
            if ($.trim(frmPopUp.village.value) == "")
            {
                alert("'지역선택의 읍면동'을 선택하여 주십시오.");
                frmPopUp.village.focus();
                return false;
            }

            return true;
        },
       
        // 테이블 tr 라인 삭제
        deleteLine : function(obj)
        {
         var tr = $(obj).parent().parent();
        
         //라인 삭제
         tr.remove();
        }
};

'IT > jquery' 카테고리의 다른 글

table 안의 라디오버튼 하나씩 체크  (0) 2016.12.15
file 등록 후 img 미리보기  (0) 2016.12.14
콤보박스 텍스트 값  (0) 2015.11.20
div 태그에 html 태그 적용  (0) 2015.04.29
동적 html 컨트롤 찾기  (0) 2015.03.04

+ Recent posts