Ajax request example. If you want to make DOM manipulation in success callback, then define a selector outside ajax function.
$.ajax({
method: 'post',
url: '/del-image',
data: {imgUrl: thisImg, id: pageId},
success: function(data) {
alert(data);
},
error: function(e) {
alert('Error' + e);
}
});