0
For some reason I’m not getting this append to work.
function mostrarUploads(id) {
$.ajax({
url: "/painel/mostrarUploads",
async: false,
method: 'POST',
data: {_token: jQuery(".token").val(), id: id},
success: function(e) {
e.forEach(function(item, indice) {
$('#bodyTabelaUploads tbody').append('<tr><td>TESTE</td></tr>');
});
}
});
}
I have this table:
<table class="table table-bordered table-striped table-hover" id="tabelaUploads">
<thead>
<tr>
<th>Nome do arquivo</th>
<th>Ações</th>
</tr>
</thead>
<tbody id = "bodyTabelaUploads">
</tbody>
</table>
I’m calling the method before opening a modal. It’s an asynchronous method, but I’m using async: false.
Is it because this method is asynchronous, the modal opens before, and I don’t see the line being added? OBS: console.log(e) returns results!!
Only to complement: Synchronous Ajax is deprecated since the
jQuery
1.8, so I recommend that you try to do everything asynchronously– Artur Trapp
Okay, thank you!!!
– Gabriel Augusto