新的Bie:我有一个列表数据,使用json format
从数据库中获取并显示到列表视图中。但我仍然混淆了如何获得列表视图的选定索引,这是我的代码:如何获得选定的索引JQuery Mobile Listview
<script>
function loadListTips(){
$('#message').html('Loading...');
$.ajax({
type: 'get',
url: "http://10.0.2.2/compfest/ajax/belajar/list_tips.php",
success: function(response){
var html = '';
$.each(response, function(index,item){
html += '<li>';
html += '<a>';
html += '<span class="judul">' + item.judul + '</span>';
html += '</a>';
html += '</li>';
});
$('#penyakit_list').html(html);
$('#penyakit_list').listview('refresh');
$('#message').html('');
},
error: function(e){
alert('Error: ' + e);
}
});
}
</script>
希望有人帮助我。
“listview的选定索引” - 你是什么意思?你试图在列表视图中为'a'标签写一个'click'事件吗? – krishgopinath
是的,我想尝试如何编写基于索引的列表视图的点击事件.. –
任何需要使用索引?其实它有点不需要..为什么你需要索引? – krishgopinath