v0.0.6 Made edit and update now works dynamically

This commit is contained in:
Victor
2021-06-03 12:50:28 +02:00
parent 256f163771
commit 4024c0dd99
9 changed files with 94 additions and 30 deletions
+13
View File
@@ -0,0 +1,13 @@
function deletePost(id) {
$.ajax({
type: 'get',
url: '../Backend/controller/deletePost.php',
data: {'delete_id':id},
success:function (data) {
console.log(data);
},
error:function (data) {
console.log(data);
}
});
}
@@ -0,0 +1,18 @@
$( document ).ready(function() {
$.ajax({
type: 'POST',
url: '../Backend/controller/getPost.php',
success:function (data) {
console.log(data);
for (let i = 0; i < data.length; i++){
document.getElementById("dis").innerHTML += "<button onClick=\"deletePost(" + data[i].id + ")\">Slet opslag</button><br>";
document.getElementById("dis").innerHTML += "<a href=\"edit.php?id="+ data[i].id + "\">Edit</a> <br><hr>"
}
},
error:function (data) {
console.log(data);
}
});
});