2012-01-03 67 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.