I looked at some sites and saw some things about it, but I can not understand the logic behind the page on demand.
jQuery(document).ready(function(){
jQuery('#btnpaginas').click(function(){
var dados = jQuery( this ).serialize();
jQuery.ajax({
type: "POST",
url: "paginacao.php",
data: dados,
success: function(data)
{
$(".paginacao").html(data);
}
});
return false;
});
});
<button id="btnpaginas">Carregar mais</button>
PHP
$inicio = 5;
$stmt = $conecta->prepare("select * from postagem order by idpost desc limit $inicio " );
$stmt->execute();
I know I'm doing it wrong. It already starts with 1 record and when I press the "load more" button it shows the first record, which it already had, and four more. But with this code I did, it will not load 5 more if I click again, I want to know how I do it whenever I click the button, it will show 5 more records for my posting system.