Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

159
Visualizações
How do I trigger firebase database?
<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.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda