i wonder if you shouldn't make sure you reinitiate the variable, so use var before:
$('a.deletepm').click(function(){ var id = $(this).attr('id'); ... On Jan 25, 2008 1:56 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi, > > I have the following problem. I have a page with several links with > class "deletepm", and when I click on the links in a very quick > sequence, the following happens: > > deleting 3 > deleting 4 > deleting 5 > > 5 deleted > 5 deleted > 5 deleted > > Here's the code: > > $('a.deletepm').click(function(){ > > id = $(this).attr('id'); > console.log('deleting '+id); > > $.ajax({ > type: "POST", > url: "ajax.php?action=deleteprivatemessage", > data: "id="+id, > success: function(response){ > console.log('comment '+id+' deleted.'); > } > }); > return false; > }); > > For some reason, the ID inside the ajax callback doesn't get the right > values.. Any idea why this could be? Thanks in advance! > -- Alexandre Plennevaux LAb[au] http://www.lab-au.com