Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function exibirAulas() {
- var pesquisa = $('#pesquisa').val();
- $.ajax({
- url:'http://localhost/estoque/usuario/pegar_aulas',
- type:'POST',
- data:{pesquisa:pesquisa},
- dataType:'json',
- success:function(json) {
- var html = '';
- if(isEmpty(json)) {
- $("#dataUsuario").html('Dados não encontrados!');
- return false;
- }
- for(var i in json) {
- if(json.status != 1) {
- html += '<tr class="table-danger">';
- } else {
- html += '<tr>';
- }
- html +='<td>'+json.email+'</td>'+
- '<td>'+'<img class="img img-thumbnail rounded imguserlist"'+ 'src=../assets/images/'+json.foto+'></img> </td>'+
- '<td>'+json.status+'</td>'+
- '<td>'+json.datainclusao+'</td>'+
- '<td class="text-center">'+
- '<a class="btn btn-outline-primary" href="editar/'+json.id+'">Editar</a>'+
- '<a class="btn btn-outline-danger" href="excluir/'+json.id+'">Excluir</a>'+
- '<a class="btn btn-outline-success" href="listar/'+json.id+'">Visualizar</a>'+
- '</td>'+
- '</tr>'
- }
- $("#dataUsuario").html('<table class="table table-bordered table-hover text-center">'+
- '<thead class="thead-inverse text-center">'+
- '<tr>'+
- '<th class="text-center">E-mail</th>'+
- '<th class="text-center">Foto</th>'+
- '<th class="text-center">Status</th>'+
- '<th class="text-center">Data Inclusão</th>'+
- '<th class="text-center">Ações</th>'+
- '</tr>'+
- '</thead>'+
- '</tbody>'+
- '</table>'+html);
- }
- });
- }
- public function pegar_aulas() {
- $usuario = new Usuario();
- if(isset($_POST['pesquisa']) && !empty($_POST['pesquisa'])) {
- $value = $_POST['pesquisa'];
- $usuario->listUsuarioAjax($value);
- $array = $usuario->listUsuarioAjax($value);
- echo json_encode($array);
- exit;
- } else {
- $array = $usuario->listUsuarioAjax("");
- print_r($array);
- echo json_encode($array);
- exit;
- }
- }
- Resposta navegador:
- {0: "344", 1: "rodrigues.caio1985@gmail.com", 2: "7363a0d0604902af7b70b271a0b96480",…}
- 0
- :
- "344"
- 1
- :
- "rodrigues.caio1985@gmail.com"
- 2
- :
- "7363a0d0604902af7b70b271a0b96480"
- 3
- :
- "b9b9503dd602b6ebe44aa1d2fbf530b5"
- 4
- :
- "2"
- 5
- :
- "2018-01-26 18:25:27"
- 6
- :
- "2018-01-27 17:53:54"
- 7
- :
- "1"
- 8
- :
- "1516998472.jpg"
- dataalteracao
- :
- "2018-01-27 17:53:54"
- datainclusao
- :
- "2018-01-26 18:25:27"
- email
- :
- "rodrigues.caio1985@gmail.com"
- foto
- :
- "1516998472.jpg"
- id
- :
- "344"
- idpessoa
- :
- "1"
- senha
- :
- "7363a0d0604902af7b70b271a0b96480"
- status
- :
- "2"
- token
- :
- "b9b9503dd602b6ebe44aa1d2fbf530b5"
- Response:
- {"id":"344","0":"344","email":"rodrigues.caio1985@gmail.com","1":"rodrigues.caio1985@gmail.com","senha":"7363a0d0604902af7b70b271a0b96480","2":"7363a0d0604902af7b70b271a0b96480","token":"b9b9503dd602b6ebe44aa1d2fbf530b5","3":"b9b9503dd602b6ebe44aa1d2fbf530b5","status":"2","4":"2","datainclusao":"2018-01-26 18:25:27","5":"2018-01-26 18:25:27","dataalteracao":"2018-01-27 17:53:54","6":"2018-01-27 17:53:54","idpessoa":"1","7":"1","foto":"1516998472.jpg","8":"1516998472.jpg"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement