These are my codes
var rootRef = firebase.database().ref().child("User");
rootRef.on("child_added", snap => {
var key = snap.key;
var name = snap.child("name").val();
var add = snap.child("address").val();
var contact = snap.child("contact").val();
$("#table_body").append("<tr><td>" + name + "</td><td>" + add + "</td>
<td>" + contact + "</td><td>" + '<button onclick="reply_click(' + key +
')">Delete</button></td></tr>');
});
function reply_click(key){
firebase.database().ref("User").child(key).remove();
window.location.reload(key);
}
i expect that if i click the delete button it will automatically deleted in firebase
Aucun commentaire:
Enregistrer un commentaire