I am retrieving firebase database and want to display data on web page like category , description etc.How can i get that thing work?I want to display value next to text like category , description .
JS
var myParam = location.search.split('itemKey=')[1];
firebase.database().ref('/Sell_Products/' + myParam).once('value').then(function (snapshot) {
var name = snapshot.child('name').val();
alert(name);
var image = snapshot.child('image').val();
var category = snapshot.child('category').val();
var description = snapshot.child('description').val();
var price = snapshot.child('price').val();
var user = firebase.auth().currentUser.uid;
var databaseRef = firebase.database().ref("auction/");
databaseRef.set({
Image: image,
category: category,
description: description,
price: price,
uid: user
});
document.querySelector('#image').src = image;
});
HTML
<div id="image1">
<div id="box">
<img id="image" />
</div>
</div>
<div>
<div id="content">
<p id="category">Category: </p>
</br>
<p id="name">Name:</p>
</br>
<p id="price">Price:</p>
</br>
<p id="decription">Description:</p>
</br>
</div>
</div>
<div id="btn">
<button class="button">BID</button>
</div>