I have this function in AJAX to update the data of a table, the data is coming correct from the controller, however it does not update with the correct data, it updates blank.
function buscaFornecedores(id) {
var url = "/Produto/BuscaFornecedor";
$.ajax({
url: url,
type: 'GET',
data: { id: id},
success: function (data) {
$("#tabelaf").html(data);
}
});
}
It would be possible to do something like this link ? I use MVC Core Page Razor.
EDIT
I get the data this way, giving a console.log (data.result)
EDITThisismyHTML:
<tableclass="table table-responsive table-hover" id="tabelaf">
<thead>
<tr>
<th>Fornecedores</th>
<th style="text-align:right"><a data-toggle="modal" data-target="#myModalAdd" title="Adicionar Novo Fornecedor" class="btn btn-info"><i class="fa fa-plus"></i></a></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.ProdutosFornecedores)
{
<tr class="tr">
<td>@item.FornecedorProduto.Nome</td>
<td align="right">
<a class="link-excluir" href="#" data-id="@item.Id" title="Excluir"><i class="fa fa-trash-o fa-lg"></i></a>
</td>
</tr>
}
</tbody>
</table>