I have a "history" in a "table", as follows:
$indices = '<table>
<tr>
<th>Selec</th>
<th>NumP</th>
<th>Fecha</td>
<th>Codigo</th>
<th>Cliente</th>
<th>Referencia</th>
<th>Detalles</th>
<th>Lente</th>
<th colspan="4">Opciones</th>
</tr>';
while($row = $result->fetch_assoc()){
$indices .= '<tr>
<td><input type="checkbox" name="check"></td>
<td>' .$row[npedido]. '</td>
<td>' .$row[fecha]. '</td>
<td>' .$row[cod_cliente]. '</td>
<td>' .$row[nombre_cliente]. '</td>
<td>' .$row[referencia]. '</td>
<td>' .$row[detalles]. '</td>
<td>' .$row[tipo]. '</td>
<td><i id="edit" class="fas fa-edit"></i></td>
<td><i class="fas fa-eye"></i></td>
<td><i class="fas fa-print"></i></td>
<td><i class="fas fa-trash-alt"></i></td>
</tr>';
}
$indices .= '</table>';
The table, shows in this way by PHP, from ajax.
In PHP, if I know how to do it, however, I can not think of a way to do this with jQuery.
- I have added 4 options, edit, view, print or delete, with 4 icons each.
The problem is that I do not know how to do it, so that when I click on the edit (for example) it shows me a "modal" to edit the order, obviously with the data I clicked ..
- In PHP, so far I have used the id parameter, from the URL, which in jQuery and Ajax I see that it would not work like this ..
I've tried .... this:
<td><i id="'.$row[npedido].'" class="fas fa-edit"></i></td>
** Now I would like to know how I could ENABLE the MODAL by clicking on the image of the class. fas fa.edit **
I've been testing like this: but it does not work
$( ".fa-edit" ).click(function() {
$('#editarPedido').show();
});
Best regards.