$(document).on("click", ".deleteProImg", function (e) { debugger if (confirm("Are you sure you want to delete?")) { var imgId = $(this).attr('id'); var _imgId = imgId.substring(10); $.ajax({ url: '/Product/DeleteProImage/', type: "POST", data: { proFileName: _imgId }, success: function (data) { $('#' + _imgId).remove(); } }); } return false; });
<div id="uploadedImages"> <div id="25cb10a7-3ae0-41a7-9b40-964ea0e74308.png"><img id="undefined" src="../Product/Image?imageName=25cb10a7-3ae0-41a7-9b40-964ea0e74308.png" width="135" height="135"> <button class="deleteProImg" id="btnProImg_25cb10a7-3ae0-41a7-9b40-964ea0e74308.png">Delete</button> <input type="hidden" value="25cb10a7-3ae0-41a7-9b40-964ea0e74308.png" name="img_81"></div></div>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)