I am new to firebase. I am appending table using firebase.
<script>
function loadcompanies(){
var leadsRef = database.ref('companies');
leadsRef.on('value', function(snapshot) {
if (snapshot.exists()) {
var content = '';
snapshot.forEach(function(childSnapshot) {
var childData = childSnapshot.val();
content += '<tr class="header" data-toggle="collapse" data-target="#accordion1" class="clickable">';
//content += '<tr class="header">';
content += '<td style="width: 55px; color: #42957F">'+childData.rooms+'</td>';
content += '<td id="companyName" style="width: 102px; font-weight: bold">'+childData.company+'</td>';
content += '<td style="width: 60px;">'+childData.code+'</td>';
content += '<td><a href="#" style="font-size:18px;" data-toggle="modal" data-target="#myModal" id="addMore" title="Add More Person"><i class="fas fa-plus-circle plus"></i></a>Add Rooms';
content += '</td>';
content += '</tr>';
//companyName.innerHTML += '<div>'+childData.company+'</div>';
//document.getElementById("companyName").innerHTML = childData.company;
//alert(childData.company);
});
$('#abctable').append(content);
}
});
}
</script>
Now i want to use the company name that i got from the firebase and use it into another form to add rooms. i cant understand how to get the company name in another function.
Aucun commentaire:
Enregistrer un commentaire