我正在尝试使用从服务器加载的<li>
元素来过滤列表。然而,什么都没有出现。这是我的代码:
<div>
<ul data-role="listview" data-theme="a" data-split-theme="b" data-split-icon="plus" data-filter="true" data-filter-placeholder="Search for courses..." data-inset="true" id="loadList">
<!-- Data below loaded from php (server) -->
<li id="clist">
<a href="#abc">
<h2>$row['Name']</h2>
</a>
</li>
<!-- Data from php finished -->
</ul>
</div>
<script>
$(function(){
$.get(
"loadAllCourses.php",
function( data ){
$('#loadList').html( data );
.listview( 'refresh' );
});
});
</script>
答案 0 :(得分:1)
好像你有一个错字。你有.html( data );.listview( 'refresh' );
应该是:
<script>
$(function(){
$.get(
"loadAllCourses.php",
function( data ){
$( '#loadList' )
.html( data )
.listview( 'refresh' );
});
});
</script>