I have this code that is generated dynamically by javascript. Simulating a grid
<tr class="produto">
<td class="info-CodBarras">123</td>
<td class="info-Descricao">teste</td>
<td class="info-Marca">nike</td>
<td class="info-Entrou">11</td>
<td class="info-QuantidadeMinima">2</td>
<td class="info-LocalEstocado">h9</td>
<td class="info-NF">453699</td>
</tr>
<tr class="produto">
<td class="info-CodBarras">333</td>
<td class="info-Descricao">teste2</td>
<td class="info-Marca">Adidas</td>
<td class="info-Entrou">112</td>
<td class="info-QuantidadeMinima">5</td>
<td class="info-LocalEstocado">H5</td>
<td class="info-NF">453699</td>
</tr>
When I debug on the console I get this array
and I would like to spend on my controller
:
document.querySelectorAll(".produto");
[tr product, tr product]
Through the code below I'm trying to get the data to my controller.
var formData = document.querySelectorAll(".produto");
$.ajax({
type: 'Post',
dataType: 'json',
url: '/EntradaEstoque/SalvarDados',
data: JSON.stringify({ data: formData }),
contentType: 'application/json; charset=utf-8',
async: false,
success: function (data) {
console.debug(data);
alert(produtos);
console.log(data);
},
error: function (data) {
console.debug(data);
}
});
}
And in my controller
it comes null.
[HttpPost]
public void SalvarDados(string data)
{
}