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

258
Vistas
How do I create a dynamic html page with javascript, depending on search value and firbase content

I might be doing this wrong but it would be great solving this with javascript. I dont have experience with any frameworks yet.

I want to create a dynamic page after searching a certain ID. There is several libaries in my firebase database, and every libary has his own books. If you search for a libary, it should open up a libary page with the correct books, included in the database.

button01.addEventListener("click", e => {

    CheckLibary(input.value);

});

function CheckLibary(i) {

    firebase.database().ref('libary/').on('value', function (snapshot) {

        if ( snapshot.val()[i]) {

           CreateLibary();

        } else {
            
            console.log("LIBARY ID DOES NOT EXIST!");

        }
      
    });

}

function CreateLibary() {

    var opened = window.open("");
    opened.document.write(`
        
    <html>
        <head>
        </head>
    
        <body>
    
            <script>
                window.onload = FillBooks();
            </script>
        </body>
    
    </html>
        
        `);
}

So far I am using window.open / document.write to create a new page. But how do I fill that Page with the right Firebase content?

I managed to trigger a function when loading that page, with the script tag down below,to use javascript to fill content into the dom. But I feel like this is the wrong way to do such task. I don't have much experience, that is just what I came up with so far, also thinking further, I seem to run into many issues this way, specially when several pages are created.

Hope to find some help. Thank you

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