![](/img/trans.png)
[英]Jquery Mobile data-role=“content” without using Jquery Mobile?
[英]how to list data according to date using jquery or jquery mobile mobile
我正在使用jquery mobile和asp.net开发图书馆移动应用程序。我是jquery mobile的新手,但是我遇到了一个问题,对于我需要显示的书籍到来的解决方案我一无所知日期在我的页面中,日期将是标题,书的缩略图下方将显示如下所示
我除了这个解决方案的代码外,我只需要一些解决这个问题的想法
注意:Json解析和HTML格式是我的主要目标
我认为您正在寻找类似的内容。我已经获取了一些示例json,并以日期作为标题显示在列表视图中。
<div data-role=header>
<h1>Home</h1>
</div>
<div data-role="content" id="home">
</div>
var response=[
{"date":"27/09/2013",
"books":["All Passion Spent",
"All the King's Men",
"An Acceptable Time",
"An Evil Cradling"]
},
{"date":"26/09/2013",
"books":["Bury My Heart at Wounded Knee",
"Butter In a Lordly Dish",
"Clouds of Witness",
"Cover Her Face"]}
];
show_response(response);
function show_response(myobj){
var ansString ='<div><ul data-role="listview" data-theme="c" data-inset="true" data-dividertheme="b" >';
$.each(myobj,function(index,quesobj){
ansString = ansString+"<li data-role='list-divider'><h3>"+quesobj.date+"</h3></li>"
for(key in quesobj.books){
ansString = ansString+'<li><a href="#">'+quesobj.books[key]+'</a></li>'
}
});
ansString = ansString+"</ul></div>"
$("#home").html(ansString).trigger("create");
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.