我完全的新本,所以请原谅我,如果我没有得到足够的信息。 我可能显示成千上万的使用JSON和列表视图的记录,不过,我需要只显示20的时间,与在底部的“显示更多”按钮。 我不明白我怎么会改变我目前的javascript考虑到这一点,希望有人能指出我在正确的方向。 我一直在试图将此代码来得到它的工作,但没有成功:
http://jsfiddle.net/knuTW/2/
我目前的JavaScript来显示JSON数据:
function getEmployeeList() {
$.getJSON(serviceURL + 'getmeals.php?calfrom='+ var1 + '&calto=' + var2, function(data) {
$('#employeeList li').remove();
employees = data.items;
$.each(employees, function(index, employee) {
$('#employeeList').append('<li><a href="employeedetails.html?id=' + employee.id + '">' +
'<img src="http://www.restaurants.com/assets/img/logos/' + employee.restaurant + '.jpg"/>' +
'<h4>' + employee.meal_item + '</h4>' +
'<p>Calories: ' + employee.calories + '</p>' +
'<span class="ui-li-count">' + employee.protein + '</span></a></li>');
});
$('#employeeList').listview('refresh');
});
}
HTML:
<div id="employeeListPage" data-role="page" >
<div data-role="header" data-position="fixed">
<h1>Restaurant Meals</h1>
</div>
<div data-role="content">
<ul id="employeeList" data-role="listview" data-filter="true"></ul>
<ul class="load-more"><a href="#">Load More</a></ul>
</div>