选择更改后,Jquery删除行会成功调用Ajax

I have twig page with table of posts. Every row has dropdown list with action options. How can I remove the row that has been processed, ie dropdown select was changed. This is a table

  <tr>
  <td>
     <a href="{{ path('posts_show', {'id': report.post.id}) }}">
                {{ report.post.title }}
     </a>
   </td>
   <a href="{{ path('ausers_show', {'id': report.reporter.id}) }}">
              {{ report.reporter.firstName }} {{ report.reporter.lastName }}
    </a>
    </td>
    <td>
       <select class="select-status" base-url="{{ path('reports_process', {'report': report.id, 'status': 'status'}) }}">
               <option value="">Process</option>
               <option value="dismiss">Dismiss</option>
               <option value="delete">Delete</option>
     </select>
    </td>
    </tr>

This script. Ajax call works fine, but I can't remove row on successful call

   <script>
    $('.select-status').change(function() {
        var url = $(this).attr('base-url');

        url = url.substr(0, url.lastIndexOf("/"));

        url =  url + '/' + $(this).val();

        processReport(url);
    });

    function processReport($url) {
        var $tr = $(this).closest('tr');
        $.ajax({
            type: "PUT",
            url: $url,
            async: true,
            data: { },
            success: function () {
                    $tr.remove();
            }
        });
    }
</script>

Please update your script block as following:

<script>
    $('.select-status').change(function() {
        var url = $(this).attr('base-url');

        url = url.substr(0, url.lastIndexOf("/"));

        url =  url + '/' + $(this).val();

        processReport(url, $(this));
    });

    function processReport(url, row) {
        var $tr = row.closest('tr');

        $.ajax({
            type: "PUT",
            url: url,
            async: true,
            data: { },
            success: function () {
                $tr.remove();
            }
        });
    }
</script>

I have not changed your code much, however there is big scope of improvements in your code. If you could share a fiddle for this, I would do it for you.