jQuery - 'this' selector doesn't work inside callback function [duplicate]
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: $(this) doesn't work in a function I'm writing post removing code in jQuery, The removing itself is made via post-request to backeds, after server returns 200, I want to delete this post on client-side. $('.delete-post').click(function() { $.post($(this).attr('href'), {}, function(data) { $(this).closest('.post').remove(); }); return false; }); However, I've noticed that inside function(data) {...) selector