I have a program here that controls a to-do list that gets written and read through the database (SQL). The main page contains a table and in each row a delete button for each table entry ... I do not handle a lot of Ajax but wanted to use a modal to confirm the deletion ( form sends 2 variables to another page which performs the operations of the bank: the first is the id of the entry that will be deleted, and the other would be the type of operation , in this case, deletion). >
If someone can give me a light on how to do it.
Modal that is called when I click the "delete" button:
<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Fechar"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="modalLabel">Excluir Item</h4>
</div>
<div class="modal-body">Deseja realmente excluir este item? </div>
<div class="modal-footer">
<button type="button" class="btn btn-primary btn-ok">Sim</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Não</button>
</div>
</div>
</div>
</div>
Delete record button:
<td class="actions">
<button type='submit' class='btn btn-danger btn-xs' id='deleta' alt='Excluir' data-toggle="modal" data-target="#delete-modal"
name='opbanco' value='excluir' title="Excluir"><span class="glyphicon glyphicon-trash" ></span></button>
</td>
The input
is inside a form that sends the data ( codigo(id)
and opbanco(operacao a ser realizada)
).
Edit:
I tried as @GuilhermeNascimento suggested "var data = 'id =' + id + '& operacao = opbanco';" and it does not roll, I believe that I was not clear in my doubt, I will complement the code
"name = 'cod_prdc' >
This is the field of the form that stores the id of the line, and clicking on the delete button it sends the other parameters (bank.php) the 2 parameters through the name of the fields the other 'opbanco' parameter is in the button delete