0
I have three files:
1) listarusuarios.php
Search the database to list
2) paginação.
who pages the archive
3) dash.js
where do I list the files without updating the page
1) listarusuario.php
send the link to the pagination and some values
$paginacao = new \App\adms\Models\helper\AdmsPaginacao(URLADM . 'usuarios/listar' , **'usuarios'**);
2) paginação.php
receives the link and the second users value
function __construct($Link, **$Var = null**){
$this->Link = $Link;
$this->Var = $Var;
}
$this->Resultado .= '<li class="page-item"><a class="page-link" href="#" onclick="listar('.$iPag.', **'.$this->Var.'**)">'.$iPag.'</a></li>';
on this line above that sends the values to the js file
3) dash.php
receives the values
$(document).ready(function () {
var varcomp = "";
var pagina = 1; //página inicial
listar(pagina, varcomp);
});
function listar(pagina, varcomp) {
var dados = {
pagina: pagina
varcomp: varcomp //quando coloca o varcomp a paginçao não funciona
};
$.post('../../adm/**usuários**/listar/' + pagina + '?tiporesult=1', function (retorna) { // eu quero que seja dinâmico para na parte aonde esta o usuários, entre outros valores ex: paginas
$("#conteudo").html(retorna);
});
}
have already done console.log(varcomp)
but the users of as >> 'users' is not defined <<
Kayo, you can do what you want with the chosen technologies yes, probably someone will answer you there with the tips, but why not use a simple two-way databinding framework like Angularjs or Vuejs? Another thing, I suggest implementing API standards that in the case of pagination would be. get and not .post. The more canonical your project, the better for maintenance and for people to help.
– Leonardo Getulio
Missing a comma between
pagina: pagina
andvarcomp: varcomp
.– Sam
in the case then I already put the comma, qdo I typed here I ski, but still not right
– cahm
I was able to make it dynamic;
– cahm