v0.1.1 - Updated Delete, Create
Added editPost (Not yet made)
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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'
|
||||
)
|
||||
}
|
||||
});
|
||||
}*/
|
||||
Reference in New Issue
Block a user