Código
function edit(){ $(document).ready(function(){ $('#del').click(function(){ var question = confirm("Ola"); if(question == true){ $.ajax({ type: 'POST', url: '../Controllers/actions.php', data: 'code='+code+'&boton=delete_product' success: function(data){ $('#records').html(data); return false; } }) return false; }else{ return false; } } }); }
Código
function show_product(){ $sql = "SELECT * FROM product"; $record = $this->conexion->conexion->query($sql); $item =0; if(!$this->conexion->conexion->query($sql)){ } if($record->num_rows>0){ while($show = $record->fetch_array(MYSQLI_ASSOC)){ $item += 1; echo '<tr id="htmltxt"> <td>'.$item.'</td> <td>'.$show["code"].'</td> <td>'.$show["product"].'</td> <td>'.$show["price"].'</td> <td>'.$show["stock"].'</td> <td><button class="btn btn-warning frm-action" onclick="edit('.$show['id_product'].');" id="edit"><span class="glyphicon glyphicon-edit"><span<button><button class="btn btn-danger frm-action" id="del" onclick="delete('.$show['id_product'].');"><span class="glyphicon glyphicon-trash"><span<button></td> </tr>'; } //this is for counting number of page } else{ echo '<tr><td colspan="7">no hay registros</td></tr>'; } }