javascript - 使用 Firebase 中的多个数据附加列表 - JavaScript
问题描述
所以我想从 Firebase 数据库中获取多个数据,然后我希望将数据附加到我的 HTML 页面中的列表中。如果有人可以帮助我解决下面代码中的问题,或者他们是更好的选择。将不胜感激。
function listitem() {
var ref = firebase.database().ref("/Users/" + uid + "/todo");
ref.once("value", (snapshot) => {
snapshot.forEach((childSnapshot) => {
var childKey = childSnapshot.key;
var childData = childSnapshot.val();
console.log(childKey);
console.log(childData);
});
});
}
//append list of items
function loadlist() {
var node = document.createElement("LI");
var textnode = document.createTextNode(listitem());
node.appendChild(textnode);
document.getElementById("toDoList").appendChild(node);
}
解决方案
推荐阅读
- amazon-web-services - 在 Athena AWS 中重命名列名
- solr - SOLR 复制计数器不断重置
- php - 如何在搜索时修复 web.php 中的路由而不会出现 404 错误?
- python - 在 AJAX 调用中传递 JSON 对象而不是数组 ->DJANGO
- android - 视图后面的访问表面
- python - ExecuteError:错误 000561:所选图层的关系无效。执行失败(SelectLayerByLocation)
- tizen - SAP:Android 提供者可以初始化与 Tizen 消费者的连接吗?
- python - 如何增加微调器中下拉列表的宽度?
- javascript - 如何将数据添加到将动态创建的 redux store 数组中?
- xquery - 代码点不合法 - SVCCODEPOINT