I am completely new to this, so please forgive me if I don't get enough information. I'm displaying potentially thousands of records using JSON and a listview, however I need to only show 20 at a time, with a "show more" button at the bottom. I'm not understanding how I would change my current javascript to allow for this, hopefully someone can point me in the right direction. I've been trying to apply this code to get it to work, but unsuccessfully:
http://jsfiddle.net/knuTW/2/
My current javascript to display the JSON data:
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>