Show live data from your database.. (or nearly!)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script> $(document).ready(function(){ (function poll() { setTimeout(function() { $.ajax({ url: "testdata.php", success: function(data) { // sales.setValue(data.value); $('.myclass').val(data); // alert(data); }, dataType: "html", complete: poll }); }, 1000); })(); }); </script> <input type="text" class="myclass" name="mybutton" value=""> |
and testdata.php can be a mysql query in a php page or a text file if needed.
It will have all the php query’s and the answer from each one is added to an array and then echoed out at the end as an array or jsonencoded. Therefore will be processed and the answer to whatever would have been output to the screen is echoed back.