每页PHP / AJAX帖子数限制

so I started developing a blog for myself, and I came to the first setback. I want to replace the posts that this function returns with ajax with the next 10. I know javascript quite well but I don't know so much about ajax (all I know that it sends a request to the server where the results are posted back, and then you can replace the data with the new data on your site)

function get_posts($i = 0,$max = 10) {
global $con;
$query = 'SELECT * FROM post';
$result = mysqli_query($con, $query);
$rows = mysqli_num_rows($result);
for (;$i < $rows&&$i < $max;$i++) {
    $row_res=mysqli_fetch_array($result);
    printf("<h1>%s</h1><p class='user'>Posted By: %s</p>
            <p class='date'>%s</p>
            <p>%s</p>", 
            $row_res["title"],$row_res["user"],$row_res["date"],$row_res["content"]);
}
}

this returns well. I made links that execute an AJAX function that should return the next ten. this is the function:

function func1() {
 var xmlhttp;
 if (window.XMLHttpRequest) {
 xmlhttp=new XMLHttpRequest();
 }

xmlhttp.onreadystatechange=function() {
 if (xmlhttp.readyState==4 && xmlhttp.status==200) {
   document.getElementById("test").innerHTML=xmlhttp.responseText;
 }
}
xmlhttp.open("GET","connect.php?func=1",true);
xmlhttp.send();

} The connect.php?func=1 points to an if that executes the get_posts() function with new args. but it doesn't show anything or it shows the first post at the top of the page and another first post in the content section.