jQuery remove element on ajax success
<p>I have <code>&lt;button&gt;</code> with ajax on it, and want to remove it after successful request.</p>

<pre class="lang-js prettyprint-override"><code>&lt;script type="text/javascript"&gt;
    $(".approve").click(function(){
        var el, image_id =  $(this).data('image-id');
        $.ajax({
            type: "PATCH",
            dataType: "json",
            data: { "approved": "True"},
            url: "/ml/api/image/" + image_id + "/?format=json",
            success: function(data){
                $(this).remove();
            }
        });
    });
&lt;/script&gt;
</code></pre>

<p>But this doesn't work…</p>
