2015-09-18 77 views
-1

我使用jQuery/AJAX和PHP/MySQL的CRUD opartions我已經刪除了鏈接我點擊一個鏈接,它會刪除我的紀錄,我想刪除記錄之前jQuery的確認!添加jQuery的確認刪除記錄

有人可以在把我的jQuery代碼確認代碼幫助!

謝謝!

jQuery代碼

$('#demo').on('click', '.delete', function(e) { 
    e.preventDefault(); 
    var edittrid = $(this).parent().parent().attr('id'); 
    data = "deleteid=" + edittrid + "&actionfunction=deleteData"; 
    $.ajax({ 
     url: "index.php", 
     type: "POST", 
     data: data, 
     cache: false, 
     success: function(response) { 
      if (response != 'error') { 
       $('#demo').html(response); 
       createInput(); 
      } 
     } 
    }); 
}); 

回答

1

嘗試這樣

$('#demo').on('click', '.delete', function(e) { 
    if (confirm('do you wanna delete?')) { 
     // user pressed yes 
    } 
}); 
+0

@Sjay歡迎你:)它ANIK不阿尼爾:) –

+0

謝謝你這麼多@Anik伊斯蘭教ABHI!我很抱歉!!! – Sjay