Any ideas, why that confirm runs twice?
Here I call the function editTableDelete:
$('button[name="deleteButton"]').click(function() {
var row = $(this).closest('tr');
editTableDelete(row);
});
This is the function editTableDelete:
function editTableDelete(row) {
'use strict';
var data = row.find('input').data();
data.content = row.find('#contentWrapper').text();
data.session = $.cookie('PHPSESSID');
data.type = 'delete';
if (confirm('Den Eintrag ' + data.content + ' wirklich löschen?'))
{
$.ajax({
url: '/adminControl/' + data.script,
type: 'POST',
data: data,
dataType: "json",
success: function (result) {
// fade out loading animation
$("td[contenteditable=true]").find("#updateLoader").fadeOut(400);
if (result.success) {
$(row).fadeOut(400, function() {
$(row).remove();
});
$('.material_alert').html(result.message);
$(this).animatedAlert({
containerAlert: $("#success_alert"),
axisX: "right",
axisY: "bottom",
autoClose: "true",
delayClose: "1000"
});
}
else {
$('.material_alert').html(result.message);
$(this).animatedAlert({
containerAlert: $("#error_alert"),
axisX: "right",
axisY: "bottom",
autoClose: "true",
delayClose: "1000",
colorOverlay: $(this).attr("data-color-overlay")
});
}
}
});
}
}
If i run script, it let me confirm it once and after conformation, comes the second confirmation box with the same entry. Why?
Thanks a lot!