[jQuery] Re: ajax variable scope (?) problem

2008-01-26 Thread Zhami
The problem is that the ajax success function runs asynchronously. In it, you refer to the variable id. So, when that function runs, it uses the latest value of id, not the value of id when the click event happened. Another way of handling the situation is to have your deleteprivatemessage return

[jQuery] Re: ajax variable scope (?) problem

2008-01-25 Thread [EMAIL PROTECTED]
It was that simple, thank you!

[jQuery] Re: ajax variable scope (?) problem

2008-01-25 Thread Alexandre Plennevaux
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 l