Passing data via HTML post JAVASCRIPT

0

Hello, I'm doing a college work, an academic control, and when trying to remove a tuple from the database passing the "id" of the tuple via post form, the value arrives either empty or undefined. Here is the code:

<tbody>
            <%for(var i=0; i<lista.length; i++){%>
                <tr>
                    <td class="mdl-data-table__cell--non-numeric"><%=lista[i].matricula%></td>
                    <td><%=lista[i].nome%></td>
                    <td><%=lista[i].IRA%></td>
                    <td><%=lista[i].codCurso%></td>
                    <td><%=lista[i].endereco%></td>
                    <td><button class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" src"admin/alteraAluno" href="admin/formAluno">Editar</button></td>
                    <td>
                        <form  action="removeAluno" method="POST">
                            <input type="hidden" name"matricula" value="<%= lista[i]%>"/>
                            <button class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored">Remover</button>
                        </form>
                    </td>
                </tr>
            <%}%>
            </tr>
        </tbody>

Here is a table and two buttons, one to change, not yet implemented, and a removal that when arriving in the javascript arrives empty or undefined

  var removeAlunoUniversidade = function(req, res){
    var connection = app.infra.connectionFactory();
    var adminDAO = new app.infra.AdminDAO(connection);

    var lista = res.body;

    console.log(lista);

    adminDAO.removeAlunoUniversidade(lista, function(err, result){
        res.redirect('listaAlunos');
    });

    connection.end();
};

app.post('/admin/removeAluno', removeAlunoUniversidade);

I'd like to know what I'm missing and if there is any other way to do that.

    
asked by anonymous 14.06.2018 / 05:55

0 answers