JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<button id="delete" class="btn btn-danger">Delete all</button> <br/><br/>
<img class="uploaded-img" src="https://i.ytimg.com/vi/WE5JV6t9i2g/maxresdefault.jpg" width="400">
<img class="uploaded-img" src="https://i.ytimg.com/vi/WE5JV6t9i2g/hqdefault.jpg" width="400">
JavaScript
$(document).ready(function() {
deleteAllImages = function() {
var paths = [];
$('.uploaded-img').each(function(i, v) {
paths.push(this.src);
})
console.log(paths);
$.ajax({
method: 'post',
data: { images: paths },
url: 'ajax.php'
}).success(function(response) {
console.log(response);
$('.uploaded-img').remove();
});
}
$('#delete').on('click', function() {
deleteAllImages();
})
})