I want to append only the last record added to firebase to a table. I tried
firebase().database().ref() .orderByChild("dateAdded") .limitToLast(1) .on("child_added", function (snapshot) { $('.table').append( "<tr><td>" + snapshot.val().train + "</td><td>" + snapshot.val().destination + "</td><td>" + snapshot.val().frequency + "</td></tr>" ); }); The first time I add a new entry it works but the second new entry is added twice, third - three times, etc.
Is there a way that will only add each new entry only once?