php - How do I insert a chunk of code every time my while loops fetches some data from my database -
i have table in database. use while loop traverse them. , make html div fetched data. used limit 10 because entries in posts keep changing users keep inserting posts table
$get_ids=mysql_query("select * posts order id limit 10"); while($row = mysql_fetch_array($get_ids)){ $sm=$row['message']; echo "<div>".$sm"</div>"; }
what want know how use jquery make script insert these 10 divs dom every 1 second or so. please urgent!!!!
try google jquery & php webservice examples. should this:
//javascript function fetches single data j.d.smith suggested function gethtml() { $.get({ 'url': 'address of php webservice', 'success': function(data) { $("#content").html($("#content").html() + data); //append html page } }); } //call function every 10 sec, place in $(document).ready() or else use window.settimeout(function () { gethtml(); }, 10000);
this code more illustrative sample working code
Comments
Post a Comment