Thursday, 15 April 2010

php - JQUERY Mobile Database Results Retrieval List View -



php - JQUERY Mobile Database Results Retrieval List View -

i trying build dynamic jquery mobile list view based off results database. have next code:

class="lang-js prettyprint-override"><script type="text/javascript">// <![cdata[ $(document).ready(function() { $.ajaxsetup({ cache: false }); // part addresses ie bug. without it, ie load first number , never refresh setinterval(function() { $('#results').load('./display.php?id=100'); }, 3000); // "3000" here refers time refresh div. in milliseconds. }); // ]]></script>

and

<div id="results"></div>

display.php has while loop

class="lang-php prettyprint-override">while($row = mysql_fetch_array($query)) { echo "{$row['title']} {$row['message']} {$row['datetime']} </br> "; }

at moment outputs title, message , datetime on .html , php pages want utilize with:

<ul data-role="listview" data-inset="true"> <li><a href="index.html"> <h3>stephen weber</h3> <p><strong>you've been invited meeting @ filament grouping in boston, ma</strong></p> <p>hey stephen, if you're available @ 10am tomorrow, we've got meeting jquery team.</p> <p class="ui-li-aside"><strong>6:24</strong>pm</p> </a></li> </ul>

i have tried number of ways working doesn't seem to, have cleaned while loop code basic question. has managed this? run <li></li> through foreach different. help appreciated.

since building listview, results div should listview... not div. suggest place

<ul data-role="listview" data-inset="true" id="results"> </ul>

instead of your

<div id="results"></div>

just starters... php should echo content of ul. mean this:

echo '<li><h3>'.$row['title'].'</h3><p><strong>'.$row['message'].'</strong></p></li>';

i did not test should.

php jquery mysql listview mobile

No comments:

Post a Comment