<div data-role="content" data-theme="" id="main" role="main">
<div data-position="fixed" data-role="footer" data-theme="a">
<div data-role="navbar">
<ul>
<li>
<a class="font-new ui-nodisc-icon loader-class" data-textonly="false" data-textvisible="true" data-iconpos="notext" onclick="$(location).attr('href', 'iprefs.php')" data-icon="home" href="#"></a>
</li>
<li>
<a data-icon="flat-menu" class="font-new ui-btn-active loader-class" data-textonly="false" data-textvisible="true" onclick="location.reload();"></a>
</li>
<li>
<a data-icon="flat-settings" class="font-new loader-class" data-textonly="false" data-textvisible="true" onclick="$(location).attr('href', 'settings.php')"></a>
</li>
</ul>
</div>
</div>
</div>
<script>$('#main').append('<ul data-filter-reveal="true" data-filter="true" data-role="listview" data-inset="true" id="applist"></ul>');</script>
您好,我有这个应用程序,我试图用我的Firebase数据库中的名称填充li,但是它创建了li,但其中没有任何名称
var list = $('#appList');
var url = firebase.database().ref('/');
url.on('value', getAppList);
function getAppList(packages){
var fbAppList = packages.val();
var childRef = url.child('/');
childRef.once('value', function(snapshot){
snapshot.forEach(function(child){
var $name = child.val().name;
});
$.each(fbAppList, function(i, app) {
console.log(name);
$('#applist').append($('<li>').append('<a href="">'+ name +'</a>'));
$('#applist').listview("refresh");
});
});
};
答案 0 :(得分:-1)
如何将代码$('