2018-10-24 15:00:27 +02:00
|
|
|
$(document).ready(function(){
|
|
|
|
$(".check").change(function(){
|
|
|
|
var dataId = $(this).parent().data("id");
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "php/edit-list.php",
|
|
|
|
data: {
|
|
|
|
function: "check",
|
|
|
|
id: dataId,
|
|
|
|
status: $(this).prop("checked")
|
|
|
|
},
|
2018-11-09 15:17:00 +01:00
|
|
|
success: function(){infoPopUp("SAVED!");},
|
|
|
|
error: function(){infoPopUp("Netzwerkfehler! Bitte aktualisieren.");}
|
2018-10-24 15:00:27 +02:00
|
|
|
});
|
|
|
|
if($(this).prop("checked")){$("[data-id='"+dataId+"']").addClass("checked");}
|
|
|
|
else{$("[data-id='"+dataId+"']").removeClass("checked");}
|
|
|
|
});
|
|
|
|
$("#remove").click(function(){
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "php/edit-list.php",
|
|
|
|
data: {
|
|
|
|
function: "del"
|
|
|
|
},
|
|
|
|
success: function(){
|
|
|
|
location.reload();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$("#nameField").focus();
|
|
|
|
$("#anzahl").on("focus", function(){$(this).select();});
|
|
|
|
$("#nameField").on("focus", function(){$(this).select();});
|
|
|
|
});
|