v0.1.1 - Updated Delete, Create

Added editPost (Not yet made)
This commit is contained in:
Anders
2021-06-08 11:23:05 +02:00
parent e2aa419efa
commit 2c89fb79f6
6 changed files with 36 additions and 13 deletions
+6 -1
View File
@@ -9,7 +9,12 @@ function createPost(title, desc) {
type: 'POST',
data: data,
success: function (data) {
console.log(data)
$('#table_id').DataTable().row.add([
title,
desc,
'<a class="w-1em" href="edit.php?id='+ data + '"><img src="Assets/Images/Icons/pencil-dark.svg" alt="Edit"></a>',
'<a class="w-1em" onClick="deletePostSwal(' + data + ')"><img src="Assets/Images/Icons/trashcan-dark.svg" alt="Delete"></a>'
]).draw().node().id = '1234';
},
error: function () {
console.log("error");
+3 -1
View File
@@ -8,7 +8,9 @@ function deletePost(id) {
'Posten er slettet!',
'',
'success'
)
).then(function() {
$('#table_id').DataTable().row($('#'+id)[0]).remove().draw();
});
},
error:function (data) {
Swal.fire(
+21
View File
@@ -0,0 +1,21 @@
/*function deletePost(id) {
return $.ajax({
type: 'POST',
url: '../Backend/controller/deletePost.php',
data: {'delete_id':id},
success:function (data) {
Swal.fire(
'Posten er slettet!',
'',
'success'
)
},
error:function (data) {
Swal.fire(
'Posten kunne ikke blive slettet',
'',
'error'
)
}
});
}*/