I know the title sounds exactly like other questions asked about this, but I've checked about ten pages deep into Google on various searches and can't find an answer. I've seen a few answers on other stack overflow questions that look like it may come close but I'm not sure how to implement what they're saying.
Currently I have this script, but it fetches the whole page of data.php.
<script type = "text/javascript" src="jquery-3.2.1.min.js"></script>
<script type ="text/javascript">
$(document).ready(function() {
setInterval(function() {
$('#show').load('data.php')
}, 5000);
});
</script>
Data.php is a page with a constantly changing list. I'm trying to get the list to update in real time, so my idea was to fetch it from another page. I'm not too familiar with Javascript since I'm more of a PHP/Python kind of guy. What I'd like it to do is append new DIVs from data.php or MySQL rows/JSON/whatever works, to the top of the list.
My problem with this is that it fetches the entire page, which is hard because some of the DIV's have media, which is a no go for refreshing the whole page. This code is also ridiculous because when you load the page up, it will show a blank white page until the it reaches the time shown. I'm just trying to have it append new DIVs with PHP generated code to the top of the page in real time, OR if I can somehow do it via MySQL or JSON I'm open to doing that as well. I'm not bad with PHP/MySQL/Python, but I'm new to JS if anyone can help. This is a personal project of mine but it's going to be for something that everyone can use online(for free). Thanks!