I have a Firebase record "searches: 0" for each user. On some event, I'd like to add 1 to what the current count is. I've gotten this far, but for some reason, it's not working:
du.fbAddSearchCount = function() {
var usr = new Firebase(firebase_url + "/users/" + user_uid);
usr.on("value", function(snapshot) {
user = snapshot.val();
var usersRef = ref.child("users");
var fbUser = usersRef.child(user_uid);
fbUser.update( {
searches: user.searches + 1
});
}
}
Any help to get this working?
Thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…