I am trying to preview images when button is clicked. Problem occuring is that when i click the first image it displays and then when i click the second image,both the images together are displayed.How can i display just one image at a time? Here is my jquery code,
function Preview(id)
{
$("#Preview_modal").modal("show");
$.post("readUserDetails.php", {
id: id
},
function (data, status) {
var user1 = JSON.parse(data);
$("#element").append($("<img />").attr('src', 'data:image/png;charset=utf8;base64,' + user1.image));
});
}