0
$.ajax({
type: "POST",
url: "php/crud.php",
dataType: "json",
data: {qtd_registros: 3, pagina: 1},
success:function(dados){
var paginacao = '<nav><ul class="pagination justify-content-center"><li class="page-item"><a class="page-link" href="index.html?pagina=0" aria-label="Previous"><span aria-hidden="true">«</span><span class="sr-only">Previous</span></a></li>';
for(var i=0;i<dados.num_paginas;i++){
if(pagina == i){$('#pag').addClass("active");}
var soma = parseInt(1) + i;
paginacao += '<li class="page-item" <a class="page-link" href="index.html?pagina='+i+'">'+soma+'</a></li>';
}
var links = dados.num_paginas - 1;
paginacao += '<li class="page-item"><a class="page-link" href="index.html?pagina='+links+'" aria-label="Next"><span aria-hidden="true">»</span><span class="sr-only">Next</span></a></li></ul></nav>';
$('table').after(paginacao);
}
});
In this case the number of the links are generated but not as links, somehow I do not know because when I check the bootstrap class 4.1 class="page-link" is not in the link appears like this <li class="page-item" <a="" href="index.html?pagina=1">2</li>
Dai as not having the class in the link the same appears as a text.
Dude you noticed there’s an open tag there right? Here’s a bug
<li class="page-item"
is missing the>
at the end of the tag!!– hugocsl
vc says on this line ? <li class="page-item" <a class="page-link" href="index.html? page='+i+'">'+soma+'</a></li>'
– Neoelectronics