0
我想建立一個基於數據庫結果的動態jQuery移動列表視圖。我有以下代碼:JQUERY移動數據庫結果檢索列表視圖
<script type="text/javascript">// <![CDATA[
$(document).ready(function() {
$.ajaxSetup({ cache: false }); // This part addresses an IE bug. without it, IE will only load the first number and will never refresh
setInterval(function() {
$('#results').load('./Display.php?id=100');
}, 3000); // the "3000" here refers to the time to refresh the div. it is in milliseconds.
});
// ]]></script>
和
<div id="results"></div>
有Display.php的while循環
while($row = mysql_fetch_array($query)) {
echo "{$row['title']}
{$row['message']}
{$row['datetime']}
</br>
";
}
目前這只是輸出標題,消息和日期時間上.html和php頁面,但我想用於:
<ul data-role="listview" data-inset="true">
<li><a href="index.html">
<h3>Stephen Weber</h3>
<p><strong>You've been invited to a meeting at Filament Group in Boston, MA</strong></p>
<p>Hey Stephen, if you're available at 10am tomorrow, we've got a meeting with the jQuery team.</p>
<p class="ui-li-aside"><strong>6:24</strong>PM</p>
</a></li>
</ul>
我已經嘗試了很多方法來使這個工作,但它似乎並沒有,我已經清除了while循環代碼,所以它的基本問題。有沒有人設法做到這一點?通常我會通過foreach運行<li></li>
,但這是不同的。任何幫助將不勝感激。
感謝您的回覆,但我在本月前排序:D – Daniel 2013-07-11 08:10:30