我有一个JSON生成的列表视图,但我不知道如何动态创建div标签来容纳所有列表项元素。它看起来像没有任何CSS格式的列表。我不知道我做错了什么。这是问题页面:http://mbeta.calvaryccm.com/#teachings这就是我想要它看起来像:http://mbeta.calvaryccm.com/我不知道如何格式化我的列表视图,以显示我需要它。jQuery Mobile JSON格式化
0
A
回答
3
如果你(通过AJAX),你需要初始化或刷新列表视图动态地添加内容:
$('#mylist').listview();
// or if you already have a listview that you are appending to
$('#mylist').listview('refresh');
见Calling the listview plugin在页面的底部。
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.
相关问题
- 1. 如何格式化jQuery Mobile文本框
- 2. jquery-mobile格式化可折叠元素
- 3. jquery mobile基本div格式化
- 4. php webservices中格式化json格式
- 5. 显式初始化Jquery Mobile?
- 6. json格式化问题
- 7. 格式化JSON
- 8. 格式化JSON
- 9. jQuery Mobile的格式在DOM
- 10. JQuery Mobile丢失格式
- 11. 忽略jQuery Mobile的格式
- 12. jQuery json格式
- 13. jQuery Mobile的/ JSON
- 14. json和jquery mobile
- 15. Jquery Mobile和JSON
- 16. jQuery DataTables Ajax GET json格式化
- 17. 从json格式化日期与jquery
- 18. obj格式化为json使用jquery
- 19. jQuery Mobile的禁用UI风格格式化
- 20. jQuery的AJAX和JSON格式
- 21. 格式化的Json
- 22. NSJSONSerialization Json格式化
- 23. Json php格式化
- 24. Mysql + json格式化
- 25. PHP + JSON格式化
- 26. JQuery/JQuery Mobile中的格式编号
- 27. 角条件格式化json
- 28. 格式化JSON输出
- 29. JSON格式化程序库
- 30. 格内容的变化只jQuery Mobile的
它的工作!感谢您的帮助! – 2012-01-03 15:51:34