jQuery - parent() not working within callback function

I was testing with parent() and closest(), none work within function.

TD stays the same, no change using this method:

$.get('form.php', function(data){ 
    alert(data); 
    $(this).closest('td').html('Done!'); 
});

TD gets updated, this method works:

$.get('form.php', function(data){ 
    alert(data); 
}); 
$(this).closest('td').html('Done!');

Can you please help me figure out why does closest('td') not working within callback function?

6
задан Teja Kantamneni 13 September 2010 в 16:22
поделиться