我正在尝试从数据库中生成一个列表视图。我从 MySQL 数据库中检索,刷新列表视图后,CSS 或设计没有更新。
列表视图是在 phonegap 中的另一个页面单击列表项时生成的
Javascript:
$('#facilityListView li').live('click',function(){
var selectedFacility = $(this).attr('name');
var appendFacilityType = $('#facilitySpecificType');
var fContent = "";
$.ajax({
type:'GET',
data: {sFacility:selectedFacility},
dataType: 'jsonp',
jsonp: 'jsoncallback',
timeout: '5000',
url: 'http://localhost/getSpecificFacilityCategory.php',
success:function(data){
$.each(data,function(f,fitem){
fContent += '<li><a href="#">' + fitem.FacilityName+ '</a></li>';
});
appendFacilityType.empty().append(fContent).listview("refresh");
},
error: function(){
alert("failed");
console.log(data);
}
});
});
固定版本
$('#facilityListView li').on('click', 'li' ,function(){
var selectedFacility = $(this).attr('name');
var appendFacilityType = $('#facilitySpecificType');
var fContent = "";
$.ajax({
type:'GET',
data: {sFacility:selectedFacility},
dataType: 'jsonp',
jsonp: 'jsoncallback',
timeout: '5000',
url: 'http://localhost/getSpecificFacilityCategory.php',
success:function(data){
$.each(data,function(f,fitem){
fContent += '<li><a href="#">' + fitem.FacilityName+ '</a></li>';
});
appendFacilityType.empty().append(fContent).listview("refresh");
},
error: function(){
alert("failed");
console.log(data);
}
});
});