Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

160
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda