2013-04-21 22 views
0

我有問題JconfirmAction這個代碼比較:JconfirmAction和Ajax後

<script type="text/javascript"> 
$(function() { 
    $(".delbutton").click(function() { 
     //Save the link in a variable called element 
     var element = $(this); 
     //Find the id of the link that was clicked 
     var del_id = element.attr("id"); 

     //Built a url to send 
     var info = 'id=' + del_id; 
     if (confirm("Sure you want to delete this update? There is NO undo!")) { 
      $.ajax({ 
       type: "GET", 
       url: "ajax_delete.php", 
       data: info, 
       success: function() { 

       } 
      }); 
      $(this).parents(".record").animate({ 
       backgroundColor: "#fbc7c7" 
      }, "fast") 
       .animate({ 
       opacity: "hide" 
      }, "slow"); 
     } 
     return false; 
    }); 
}); 
</script> 

我嘗試添加該腳本,使用此代碼存在的頁面:

<script type="text/javascript"> 
    $(document).ready(function() { 
     $('.ask-custom').jConfirmAction({question : "Usunąć ?", yesAnswer : "Tak", cancelAnswer : "Nie"}); 
    }); 
</script> 

鏈接與class

<a href="#" id="<?php echo $row['id']; ?>" title="DELETE" class="ask-custom delbutton"> 

任何提示? 此致敬意。

+0

所以......有什麼錯誤? – Jon 2013-04-21 08:39:49

+0

沒有錯誤,只是我不知道如何比較這兩個腳本。我試圖改變'如果(確認..「jConfirmAction,但我做錯了什麼:( – 2013-04-21 08:45:22

+0

這些可能是兩個不同的故事庫,有兩個不同的故事 – Sedz 2013-04-21 10:29:00

回答

0

試着改變你的ajax要求:

$.ajax({ 
       type: "GET", 
       url: "ajax_delete.php", 
       data: {id:del_id}, 
       success: function() { 

       } 
      }); 
+0

沒什麼。仍然當我點擊確認「YES」時沒有任何改變。 – 2013-04-21 11:06:21