<div class="namaz" id="zora">Zora: </div>
<div class="namaz" id="izlazak">Izlazak sunca: </div>
<div class="namaz" id="podne">Podne: </div>
<div class="namaz" id="ikindija">Ikindija: </div>
<div class="namaz" id="aksam">Akšam: </div>
<div class="namaz"id="jacija" >Jacija: </div>
Inside of these div’s there’s a time (eg 15:36) that I withdrew from a certain API, how do I send a trigger to the firebase database using javascript that will change just one variable when the time is equal to that one in the div?
function fetchData() {
fetch("https://api.vaktija.ba/")
.then(response => {
return response.json();
})
.then(data => {
const arr = data.vakat;
const elements = document.getElementsByClassName("namaz");
Array.from(elements).forEach((element, index) => {
element.innerText = `${element.innerText} ${arr[index]}`;
})
})
.catch(error => {
console.log(error)
});
}
This is a function I’m using for getting the data from the API and placing it inside of the div’s.
cool-vaktija-default-rtdb
aktivno: "nije"
This is the variable value. From “nije” to “jest” or something else.
https://cool-vaktija-default-rtdb.europe-west1.firebasedatabase.app/
And the link for it.