我有以下 HTML 代码。这是一个弹出窗口,里面有一个可折叠的列表项:
<div data-role="popup" id="wavelistPopup" class="ui-content">
<div id="wavlistContainer" data-role="collapsible-set" data-theme="c" data-content-theme="c" data-collapsed-icon="arrow-r" data-expanded-icon="arrow-d" style="margin:0; width:250px;">
<div data-role="collapsible" data-inset="false">
<h2>Wave1</h2>
<ul data-role="listview">
<li>Entfernung: </li>
<li>Von Autor:</li>
<li>Schwierigkeit:</li>
<li>Beschreibung:</li>
<li><a data-rel="dialog">Erfahrungsberichte</a></li>
<li><a data-rel="dialog">Wissenswertes</a></li>
<li><a data-rel="dialog">Ähnliche Waves</a></li>
</ul>
<button>Sync</button>
<button>Löschen</button>
</div><!-- /collapsible -->
</div><!-- /collapsible set -->
</div><!-- /popup -->
现在我想使用以下代码向 wavlistcontainer 添加另一个可折叠:。为此,我首先进行 ajax 调用并在回调函数中工作。
function populateWaveList(){
console.log("populateWaveList");
requestWavesInArea(position.position.coords.latitude, position.position.coords.longitude,
position.position.coords.latitude+5, position.position.coords.longitude+5, 10,
function(waves){ //after AJAX call
console.log(waves);
for(var wavei in waves){ // for every element to add
var content = "";
var wave = waves[wavei];
console.log(wave);
var content =+ jQuery('somestring'; '<div data-role="collapsible" data-inset="false">'+
'<h2>'+wave.name+'</h2>'+
'<ul data-role="listView">'+
'<li>Entfernung von Autor: '+'...'+'</li>'+
'<li>Autor: '+wave.creatorname+'</li>'+
'<li>Beschreibung: '+wave.description+'</li>'+
'<li>Umfang: '+'...'+'</li>'+
'<li>Terrain: '+wave.terrainType+'</li>'+
'<li>Autor: '+wave.creatorname+'</li>'+
'<li>Schwierigkeit: '+wave.difficulty+'</li>'+
'<li>ID: '+wave.waveId+'</li>'+
'<li>Datum: '+wave.created+'</li>'+
'</ul>'+
'<button disabled="disabled">Sync</button>'+
'<button disabled="disabled">Löschen</button>'+
'</div>');
console.log(content); // returns 'false'
$('#wavelistContainer').append(content);
}
$('#wavelistPopup').popup('open', { x : 460, y : 180 });
});
}
当我打印内容时,我得到false
了这让我非常困惑。任何人都可以帮我解决这个问题吗?
谢谢