I am trying to use the confirmation method, but for some reason the confirmation window appears several times. I googled and tried different things, but unfortunately I cannot get it to work properly. The code is as follows:
$("#deletePopUpImage").click(function(){
console.log("deletePopUpimageCalled");
id = ($(this).parent().prop("id"));
data = "typ=function&functionType=deleteUserImage&id="+id;
var r = confirm("Are you sure that you want to delete this image?");
if (r == true) {
console.log("loadAjaxCAlled");
loadAjax(data);
hideImagePopup();
} else {
}
});
It is strange that sometimes the confirmation window appears twice, sometimes three times, and sometimes as expected. This is why two console.logs were inserted.
"deletePopUpimageCalled" always appears only once. However, "loadAjaxCAlled" appears several times.
In the callback of the Ajax method, I just hide the thumbnail of the div.
Do you know what's wrong with my code above?
Thanks Stefan
source
share