So you can use the prepend
method:
<script>
$(document).ready(function(){
var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>";
var dataArray = <?php echo json_encode($current_posts_ids) ?>;
function getMyPosts() {
data = { action: "update_news", data: dataArray};
$.post(ajaxurl, data, function(response) {
// reset array
dataArray = [];
// append the new news posts
$('.latest-news .posts').prepend(response);
// create new array of ids to exclude
$('article').each(function(){
dataArray.push($(this).data('id'));
});
// repeat function after 5 seconds
setTimeout(function () {
getMyPosts();
}, 5000)
});
}
//run the function first time
getMyPosts();
});
</script>