2013-11-28 32 views
0

當我點擊一個按鈕,父div不會被刪除,什麼都沒有被調用。刪除div與Ajax不工作

我的JavaScript部分:

<script> 
    $(document).ready(function() 
{ 
    $('.delete').click(function() { 
     var parent = $(this).closest('div'); 
     $.ajax({ 
      type: 'get', 
      url: 'delete.php', // <- replace this with your url here 
      data: 'ajax=1&delete=' + $(this).attr('id'), 
      beforeSend: function() {    
       parent.animate({'backgroundColor':'#fb6c6c'},300); 
      }, 
      success: function() { 
       parent.fadeOut(300,function() { 
        parent.remove(); 
       }); 
      } 
     });   
    }); 
}); 

而我的HTML部分

<div> 
    Some name 
    <button type="submit" class="delete" value="Delete" id="multipleValues">Delete</button>         
</div> 

而且這個div是jQuery的dynatree擴展

+0

內部點擊觸發的事件?父母是否是預期的元素?是否稱爲成功回調?如果亞,它應該工作!如果不是,請告訴我們什麼不工作?! –

+0

回答