Foro de elhacker.net

Programación => PHP => Mensaje iniciado por: geshiro en 5 Octubre 2015, 05:32 am



Título: ayuda con el id de un archivo externo jquery y php
Publicado por: geshiro en 5 Octubre 2015, 05:32 am
al momento de presionar el boton no me mande ni el mensaje ni me borra y como puediera solucionarla ya que el del esta en otro archivo diferente o como lo hago mandar llamar


Código
  1. function edit(){
  2.  $(document).ready(function(){
  3.  $('#del').click(function(){
  4.    var question = confirm("Ola");
  5.    if(question == true){
  6.      $.ajax({
  7.        type: 'POST',
  8.        url: '../Controllers/actions.php',
  9.        data: 'code='+code+'&boton=delete_product'
  10.        success: function(data){
  11.          $('#records').html(data);
  12.          return false;
  13.        }
  14.     })
  15.      return false;
  16.      }else{
  17.            return false;
  18.      }
  19.    }
  20.  });
  21.  
  22. }
  23.  


Código
  1. function show_product(){
  2. $sql = "SELECT * FROM product";
  3. $record = $this->conexion->conexion->query($sql);
  4. $item =0;
  5.  
  6. if(!$this->conexion->conexion->query($sql)){
  7. printf("Errormessage: %s\n", $this->conexion->conexion->error);
  8. }
  9. if($record->num_rows>0){
  10. while($show = $record->fetch_array(MYSQLI_ASSOC)){
  11. $item += 1;
  12. echo '<tr id="htmltxt">
  13. <td>'.$item.'</td>
  14. <td>'.$show["code"].'</td>
  15. <td>'.$show["product"].'</td>
  16. <td>'.$show["price"].'</td>
  17. <td>'.$show["stock"].'</td>
  18. <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>
  19. </tr>';
  20. }
  21. //this is for counting number of page
  22.  
  23. }
  24. else{
  25. echo '<tr><td colspan="7">no hay registros</td></tr>';
  26. }
  27. }
  28.