Как удалить элемент списка <div class="image-?">...</div>
в функции complete
запроса ajax? $(this)
...?
<div class="edit-image-list">
@foreach (var image in Model.AttachedImages)
{
<div class="image-@image.Id">
<img width="180" height="180" src="data:image/jpeg;base64,@(Convert.ToBase64String(image.Data))" class="img-thumbnail" alt="Responsive image">
<a class="delete-image" data-id="@image.Id">Delete</a>
</div>
}
</div>
<script>
$(document).on('click', '.delete-image', function (e) {
e.preventDefault();
console.log($(this).data("id"));
$.ajax({
method: "POST",
url: "@Url.Action("DeleteImage","Forum")",
error: function () {
console.log('error');
},
data: { Id: $(this).data("id") },
complete: function () {
// How to delete class="image-?"
}
});
});
</script>