データベースからの結果に基づいて、動的な 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ループコードをクリーンアップしたので、この質問の基本です. 誰かがこれを行うことができましたか?通常は<li></li>
foreach を実行するだけですが、これは異なります。どんな助けでも大歓迎です。