Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getowners(){
- $.ajax({
- type: 'GET',
- url: '/get-owners',
- dataType: 'json',
- success: (data)=>{
- alert(data);
- $.each(data,(index,item) => {
- const fila = $('<tr></tr>'); // Creamos la fila
- const img = $('<td></td>').append($('<img class="image">'));
- const name = $('<td></td>').addClass('name');
- const action = $('<td></td>').addClass('action');
- fila.append(img).append(name).append(action); // Preparamos la fila
- data.forEach(dato => { // Iteramos los datos
- const miFila = fila.clone(); // Clonamos la fila.
- miFila.find('img').attr('src', dato.img); // Ponemos la imagen
- miFila.children('.name').html(dato.name); // Ponemos el nombre
- $('#ownerT').append(miFila); // Pegamos la fila a la tabla
- });
- });
- }
- });
- //$("#ownerT").load();
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement