Hello, I'm a noob about Golang, I'm studying and making samples... I have a form HTML with inputs and a table I created a function to update and execute a function javascript In function, js get all information from HTML, inputs, and table, but in golang I don't get the table information...How can I do it?
Function Golang func EditarCondicaoPagamento(w http.ResponseWriter, r *http.Request) { //para post, put usase o ParseForm para ler os dados da pagina html r.ParseForm() //r.FormValue("nome do campo no html") le o valor do campo no form html codCondicaoPagamento, _ := strconv.ParseUint(r.FormValue("codCondicaoPagamento"), 10, 64) //pega o codigo do servico que está no form html //le os valores do formulario html condicaoPagamento, erro := json.Marshal(map[string]interface{}{ "codCondicaoPagamento": codCondicaoPagamento, "nome": r.FormValue("nome"), "numParcelas": r.FormValue("numParcelas"), //"codFormaPagamento": r.FormValue("codFormaPagamento"), "parcelas": r.FormValue("parcelas"), }) fmt.Println(bytes.NewBuffer(condicaoPagamento)) I don't get array value "parcelas" Result: {"codCondicaoPagamento":4,"nome":"ENTRADA + 1","numParcelas":"2", "parcelas":""} Function JS function editarCondicoesPagamento(evento){ evento.preventDefault(); var parcelasTabela = []; var lista = $('#dtcondicoesPagamentoParcelamento'); $(lista).find("tr").each(function(index, tr) { parcelasTabela.push(JSON.stringify({"codCondicaoPagamentoParc": $(tr).find('td:eq(0)').html(), "numParcela" : $(tr).find('td:eq(1)').html(), "dias" : $(tr).find('td:eq(2)').html()})) }); parcelasTabela.shift(); $.ajax({ url : `/editar-condicoespagamento`, method : "PUT", data : { codCondicaoPagamento : $( "#codCondicaoPagamento" ).val(), nome : $( "#nome" ).val(), numParcelas : $( "#numParcelas" ).val(), parcelas : parcelasTabela, } }).done(function (){ Swal.fire("Sucesso","Dados Atualizados com Sucesso!","success") /*.then(function(){ window.location = "/editar-cliente";//perfil });*/ }).fail(function() { Swal.fire("Ops...","Erro ao Atualizar!","error") }); } Thanks! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/0fd9b162-b132-494b-95f2-3f2d9a08144fn%40googlegroups.com.