I have a file called messages.php which runs SQL queries to a database and displays results in a $res variable
My menu.php page I used
i
This requires the jQuery library. It could be done in pure JS, but if you're a JS beginner I recommend using jQuery.
function reload_messages(){
$.get("messages.php", function(data) {
$("#id").html(data);
});
}
You will then need to call reload_messages, for example:
reload messages
If you want to expand on the .get method, check out this page: https://api.jquery.com/jQuery.get/