我有一个从$.ajax调用创建的列表.数据注入似乎有效,但HTML没有为listView选择JQueryMobile样式.任何人都可以提供任何有关为什么会发生这种情况的见解?
这是Ajax调用:
function getF(){
// Show a loading message
var SomeData_list = document.getElementById("SomeData_list");
SomeData_list.innerHTML = "PHP?;
// Do the ajax call
$.ajax({
url: gUrl,// Callback (onsuccess)
success: function(d,status,req){
var json = eval('(' + d + ')');
showSomeData(json);
},// Error handler
error: function(req,err){
// Alert the user that something went wrong
var group_list = document.getElementById("group_list");
SomeData_list.innerHTML = "
function showSomeData(json){
var SomeData_list = document.getElementById("SomeData_list");
SomeData_list.innerHTML = "";
var dt =json.results;
if (dt.length <= 0){
SomeData_list.innerHTML += "
最佳答案
一旦填充了列表元素,请务必刷新它,否则 – 如您所见 – 未应用jQM样式:
SomeData_list.listview('refresh');