카테고리 없음

table tr 동적으로 삭제하기

쵸코푸들이장군 2018. 2. 13. 07:34

doDelete : function(popupSeq , obj){

   if(confirm('팝업을 삭제 하시겠습니까?')){

    $.ajax({

     url    : url,

     data    : 'popupSeq='+popupSeq,

     contentType  : "application/x-www-form-urlencoded; charset=UTF-8",

     dataType   : "json" ,

     sendDataType  : "string",

     success   :function(resData, statusText){

      if(resData.responseCode == '0'){

       var data = resData.data;

       if(data == 1){

        alert('삭제성공');

       deletePopupList(obj);

       }else{

        alert('삭제실패');

       }

      }

     }

    });

   }

  },

  

  deletePopupList : function(obj){

   var removeObj = $(obj).parents("tr");

   var parentObj = $(removeObj).parents("table");


   $(removeObj).remove();

  }



//////////////////////////html////////////////////////////

<button id="del_btn" onclick="javascript:popupManage.doDelete('popupSeq' , this);">삭제</button>






* 이상하게 tr에 id 값을 줘서 id 값으로 가지고 오려고 하면 잘 안된다. 왜 ???? !!!!!!!!!!!!!!!!!!!