witam
zrobiłem sobie usuwanie wpisów z shoutboxa. Problem tkwi w tym ze kod wywołuje $('.del').click(); , divow z tymi klasami jest kilka, i skrypt usuwa nie ten w ktory sie kliknie tylko ostatni dodany:
$(document).ready(function() {
$('.del').click(function() {
var loading = $('#loading');
var messageList = $('.content > ul');
var id = $('.delete').attr('id');
messageList.fadeOut();
loading.fadeIn();
$.ajax({
type: 'POST', url: 'shoutbox.php', data: 'action=delete&id=' + id,
complete: function(data){
$.ajax({
type: 'POST', url: 'shoutbox.php', data: 'action=update',
complete: function(data){
loading.fadeOut();
messageList.html(data.responseText);
messageList.fadeOut();
messageList.fadeIn(2000);
}
});
}
});
});
});
echo "<div class='contentin'><span class='shoutbox_nick'><b>".$row['user']." </b></span> <span class=\"date\"> ".$row['date']."</span><br /><span class=\"message\">".$row['message']."</span>"; if($_SESSION['ranga'] == 3){
echo "<div class='del'><a href='#usunWpis' class='delete' id='".$row['id']."'>[Usun]</a></div>"; }