2012-01-03 105 views

回答

3

如果你(通过AJAX),你需要初始化或刷新列表视图动态地添加内容:

$('#mylist').listview(); 
// or if you already have a listview that you are appending to 
$('#mylist').listview('refresh'); 

Calling the listview plugin在页面的底部。

+0

它的工作!感谢您的帮助! – 2012-01-03 15:51:34

0

好了,我不能在这里写全代码,但我相信你需要写的东西是这样的:“ATTR(

// i assume your JSON response is stored in data object 
// following is the loop which reads the data object ,gets the value and append it to the `<li>` of `<ul>` 

变种名单= $(”)“ID”,”清单“); // jQuery中动态创建一个新的UI元素

for(var i=0;i<data.length;i++) 
{ 

var li=$("<li/>").html(data[i].name); // get the value of name in JSON and put it in newly created li ,(getting value will depend on your json string format) 

$("#list").append(li); //append li to ul of id list 

} 

$(body).append(list); // append the list to anywhere you want, i am appending it to body.