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

327
Views
How do I fetch the value from a key in firebase using javascript

See the image i want to fetch this value in javascript

 var dbImages = firebase.database().ref("images");

 dbImages.on("value", function(images){

    if(images.exists()){
        var imageshtml = ""; 
        images.forEach(function(fetchImages){

             console.log("key: " + fetchImages.key);
             console.log("title: " + fetchImages.title);
             console.log("url: " + fetchImages.url);

        });
     }

});

Its only showing key value not other value i want to view key value and also the value of key value please help guys

This is the output of my javascript

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You are using forEach() and DataSnapshot of /orders node where each child node seems to be a category and not the image itself. You'll have to loop over each image of the categories to list them:

firebase.database().ref("images").once("value").then((imagesCategories) => {
  if (imagesCategories.exists()) {
    var imageshtml = "";

    // For each category
    imagesCategories.forEach(function(categoryImages) {
      // For each category image
      categoryImages.forEach(function(image) {
        // Append data to imageshtml from here
        console.log(image.val().url)
        console.log(image.val().title)
      })
    })
  }
});
about 4 years ago · Juan Pablo Isaza Report
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!