2021-06-03 10:50:28 +00:00
|
|
|
function deletePost(id) {
|
2021-06-08 07:07:58 +00:00
|
|
|
return $.ajax({
|
2021-06-07 13:01:28 +00:00
|
|
|
type: 'POST',
|
2021-06-03 10:50:28 +00:00
|
|
|
url: '../Backend/controller/deletePost.php',
|
|
|
|
data: {'delete_id':id},
|
|
|
|
success:function (data) {
|
2021-06-08 07:07:58 +00:00
|
|
|
Swal.fire(
|
|
|
|
'Posten er slettet!',
|
|
|
|
'',
|
|
|
|
'success'
|
2021-06-08 09:23:05 +00:00
|
|
|
).then(function() {
|
|
|
|
$('#table_id').DataTable().row($('#'+id)[0]).remove().draw();
|
|
|
|
});
|
2021-06-03 10:50:28 +00:00
|
|
|
},
|
|
|
|
error:function (data) {
|
2021-06-08 07:07:58 +00:00
|
|
|
Swal.fire(
|
|
|
|
'Posten kunne ikke blive slettet',
|
|
|
|
'',
|
|
|
|
'error'
|
|
|
|
)
|
2021-06-03 10:50:28 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|