I'd like to post some content from a database on an html page. I'm not sure what the best way to do this is but my guess would be something that resembles the code below. Please let me know if there is a better way.
HTML:
$(document).ready(function(){
$.ajax({
type : "POST",
url : 'tablepageload.php',
data : 'test',
success: function(data) {
$('#echobox').html(data);
}
});
});
PHP:
if (isset($_POST['test'])) {
$sendtable = "SELECT `timein` FROM `timestamp` WHERE id='" . $latestrow . "' LIMIT 1";
$result = mysqli_query($link, $sendtable);
$row = mysqli_fetch_array($result);
echo $row['timein'];
};