1
I’m using MVC4 C#,
I have a table that is generated dynamically according to the user’s decision, in this format:
generated by js
<tr class="itemPedido"> ' +
'<td class="col-sm-1">' +
'<p class="codigo">' + $(this).attr('data-codigo') + '</p>' +
'</td>' +
'<td class="col-sm-4">' +
'<p class="desc">' + $(this).attr('data-desc') + '</p>' +
'</td>' +
'<td class="col-sm-1">' +
'<p class="un">' + $(this).attr('data-un') + '</p>' +
'</td>' +
'<td class="col-sm-1">' +
'<p class=grupo">' + $(this).attr('data-grupo') + '</p>' +
'</td>' +
'<td class="col-sm-1">' +
'<input class="form-control qnt" step ="0.01" type="number" placeholder="' + parseFloat($(this).attr('data-qnt').replace(',','.')) + '" data-max="' + $(this).attr('data-qnt') + '"' +
'</td>' +
'<td class="col-sm-1">' +
'<input class="form-control preco"step="0.01" type="number" value="'+parseFloat($(this).attr('data-preco').replace(',','.'))+'"' +
'</td>' +
'<td class="col-sm-1 total">' +"R$ 0.00"+
'</td>' +
'</tr>'
what I want is to generate an object to climb through ajax
of all listed objects plus some objects that are not in the table, as payment method;
follows the js
that I’ve assembled so far
var data = {
date : $('#Data').val(),
clienteNo: $('#ClienteNO').val(),
clienteRaz: $('#ClienteRazao').val(),
entrega: $('#Entrega').val(),
formapg: $("#FormaPg").val(),
tipopg: $('#tipopg').val(),
frete: $('#frete').val(),
processo: $('#Processo').val(),
obs: $('#Obs').val(),
traNum: $('#TraNumero').val(),
traRaz: $('#TraRazao').val(),
traTel: $('#TraTel').val(),
produtos: /*?????*/
}
The question marks refer to the product I want to assemble through the table, does anyone have any solution to my problem? and how I receive this value in Controller
?
Do you have any
form
? then it would be enoughform.serialize();
?– Sergio
I do, but since this list is being created dynamically, the generated object is going null to the Controller
– Um Programador