Because you are overwriting confirm
.
This line:
confirm = window.confirm("Nutzer wirklich löschen?");
is equal to
window.confirm = window.confirm("Nutzer wirklich löschen?");
One of the reasons why using globals is a very bad idea. When you are declaring a variable, please always use var
, so it will not be global:
var confirm = window.confirm("Nutzer wirklich löschen?");
The same would apply to User
. You should declare it like:
var User = $(this).attr("data-link");