0
I have this function in AJAX to update the data of a table, the data is coming from the controller correctly, but 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 ? Utilizo MVC Core Page Razor.
EDIT
I receive this way the data, giving a console.log(date.)
EDIT This is my HTML:
<table class="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>
What is the format of your answer ?
– Pedro Augusto
I updated the question.
– Mariana
The link you posted exemplifies exactly what you need. Did you consider using it that way ? You made a mistake ?
– Pedro Augusto