Ver Mensaje Individual
  #4 (permalink)  
Antiguo 21/02/2014, 12:59
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
Respuesta: Llamar funcion desde el div de repuesta del php

He podido hacerlo poniendo la funcion en en el php pero solo me funciona en la primera fila de la tabla.

Código Javascript:
Ver original
  1. $result = mysql_query("SELECT * FROM detalle_factura_mc where id_aviso = '".$_POST['id_aviso']."'", $link);
  2. if ($row = mysql_fetch_array($result)){
  3.  
  4. while ($field = mysql_fetch_field($result)){
  5.             echo "<td>$field->name</td> \n";
  6. }
  7.          
  8. do {
  9.             echo "<form method='POST' name='form10' id='form10'> \n";  
  10.             echo "<table width='100%' > \n";
  11.             echo "<tr> \n";
  12.             echo "<td><input type='text' name='almacen' id='almacen' size='2' /></td>\n";
  13.             echo "<td><input type='text' name='recambio' value='" . $row['recambio'] . "' size='10' /></td>\n";
  14.             echo "<td><input type='text' name='denominacion'  size='25' value='" . $row['denominacion'] . "' /></td>\n";
  15.             echo "<td><input type='text' name='cantidad' value='".$row["cantidad"]."' size='5' /></td>\n";
  16.             echo "<td><input type='text' name='pvp' value='".$row["pvp"]."' size='5' /></td>\n";
  17.             echo "<td><input type='text' name='descuento' size='5'  value='".$row["descuento"]."' /></td>\n";
  18.             echo "<td><input type='text' name='pvp_total' value='".$row["pvp_total"]."' size='5' /></td>\n";
  19.             echo "<td><img src='imagenes_menu/modificar.jpeg' id='mod10' width='20' height='20' style='cursor:pointer' /></td> \n";
  20.             echo "<td><img src='imagenes_menu/cancelar.png' id='del10' width='20' height='20' style='cursor:pointer' /></td> \n";
  21.             echo "<td><input type='hidden' name='id_fact' value=".$row['id_fact']." /></td> \n";
  22.             echo "<td><input type='hidden' name='MM_update' value='form10' /></td> \n";
  23.             echo "</tr> \n";
  24.             echo "</table> \n";
  25.             echo "</form> \n";
  26.        
  27.            
  28.          } while ($row = mysql_fetch_array($result));
  29.            
  30.    
  31. } else {
  32. echo "¡ No se ha encontrado ningún registro !";
  33. }
  34.  
  35.  
  36.  
  37.  
  38.   }
  39. }
  40.  
  41. ?>
  42.  
  43. <script>
  44.  
  45. $(document).ready(function() {
  46.    
  47.    
  48.     $("#mod10").click(function(){
  49.        
  50.  
  51.       $("#form10").trigger("submit");
  52.        });
  53.    
  54.  
  55.     $('#form10').submit(function(event) {
  56.      var datos = $(this).serialize();  
  57.       event.preventDefault()
  58.       $.ajax(
  59.         {
  60.             url:'update_recam.php',
  61.             type:'POST',
  62.             data:datos,
  63.             beforeSend:function(objeto){
  64.                 $('#carga').css({display:'block'});
  65.             },
  66.             complete:function(){
  67.                 $('#carga').css('display','none');
  68.                 },
  69.             success: function(data) {
  70.                 $('#result3').html(data);
  71.    
  72.             }
  73.         });
  74.     });
  75.  });   
  76. </script>