Advertisement
joaopaulofcc

Untitled

Sep 22nd, 2021
1,239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.90 KB | None | 0 0
  1. $(document).ready(function() {
  2.     listarGrid();
  3.     $('#filtrar').click(filtrar);
  4. });
  5.  
  6. function listarGrid(){
  7.     $.get('https://localhost:5001/Colaborador/Listar')
  8.         .done(function(resposta) {
  9.             for(i = 0; i < resposta.length; i++) {
  10.                let dados = resposta[i];
  11.                
  12.                $('#grid').append($('<tr></tr>').attr('id', dados.id));
  13.                
  14.                 $('#' + dados.id).append($('<td></td>').html(dados.id));
  15.                 $('#' + dados.id).append($('<td></td>').html(dados.nome));
  16.                 $('#' + dados.id).append($('<td></td>').html(dados.idCargoNavigation.nome));
  17.                 $('#' + dados.id).append($('<td></td>').html('R$ ' + dados.salario.toFixed(2).toString().replace('.', ',')));
  18.             }
  19.         })
  20.         .fail(function(erro, mensagem, excecao) {
  21.             alert(mensagem + ': ' + excecao);
  22.         });
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement