I ran into a very vague error while doing some simple jQuery DOM manipulation.
The line that triggered the error is the following:
$(this).closest(\'tr\')
Inside your request, $(this) is not the .remove element. It's a closure problem.
.remove
So you can assign $(this) to a variable before and call it after