Answer the question
In order to leave comments, you need to log in
How to get data from firebase and display it in a list?
How to display data from firebase on pure js + html and list it in html?
Answer the question
In order to leave comments, you need to log in
well... like this
function MenuView (obj) {
return `<li id="${Object.keys(obj)}">${Object.values(obj)}</li>`
}
const fetchMenu = async (name) =>{
const url = `https://testprese.firebaseio.com/${name}/.json`;
const response = await fetch(url);
return await response.json();
}
(async ()=>{
const menu = await fetchMenu ("menu");
let list = '';
menu.forEach((item) => {list += MenuView(item);});
document.getElementById('menu').innerHTML = list;
})();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question