Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!