Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var showData = document.getElementById("showData");
- var button1 = document.getElementById("but1");
- var usersRef =
- firebase.database().ref('stores/').orderByChild("sid").equalTo(123);
- function s2_but() { //function gets trigger when button pressed
- usersRef.on('value', snap);
- function snap(data) {
- data2 = data.val();
- console.log(data2);
- showData.innerHTML = data2.sname; //sname is the name of child key
- //whose value I want to show
- }
- };
- entry1: {prod1: "coffee", prod2: "sandwich", sid: 123,
- sname: "Java Coffee"}
- __proto__:Object
- <p id="showData"></p>
- showData.innerHTML = data2.sname;
Add Comment
Please, Sign In to add comment