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>