Pager does not work on call from ajax


Hello, I have a simple pager. The paginator works entering from its own page, but it turns out that the data that pages are loaded in a div through AJAX, then when trying to advance between the links of the pager shows me an error of Object not localized!.

I have attached code where I have the pager.

<div id="Cusuarios">
  <table class="highlight responsive-table" id="Dusuarios">
        $pagActual = 1;
        $regMostrar = 5;
        if (array_key_exists('pg', $_GET)) { $pagActual = $_GET['pg']; }
        $mysqli = mysqli_connect('localhost', 'root', '', 'paginador');
		if ($mysqli->connect_errno) {
		  echo "Falló al conectar ".$mysqli->connect_errno;
        $query =  $mysqli->query("SELECT COUNT(*) as total FROM usuarios");
		$total = "";
		if ($query) {
		  while ($obj = $query->fetch_object()) { $total = $obj->total; }
		if ($total<$regMostrar) { $ultimaPag = 1; }
        else { $ultimaPag = intval($total/$regMostrar); }
		$segmento = $mysqli->query("SELECT * FROM usuarios LIMIT ".(($pagActual-1)*$regMostrar).", ".$regMostrar."");
		if ($segmento) {
		  while ($fila = $segmento->fetch_object()) {
			echo "<tr id='".$fila->id."'>";
            echo "</tr>";
<ul class="pagination">
    echo "<li class='waves-effect'><a href='paginador.php?pg=".(1)."' title='Primera'>primera</a></li>";
    for ($i=0; $i<$ultimaPag; $i++) {
      echo "<li class='waves-effect "; if ($pagActual == $i+1) { echo "active"; }
      echo "'><a href='paginador.php?pg=".($i+1)."'>".($i+1)."</a></li>";
    echo "<li class='waves-effect'><a href='paginador.php?pg=".($ultimaPag)."' title='Última'>ultima</a></li>";

The AJAX call is made through a link.

<script src=""></script>
<ul class="menu">
    <a href="#" class="btn-floating usuario">usuario</a>
<div class="col l9 s12 contenido">
asked by Johan Solano Contreras 27.11.2018 в 04:27

0 answers