Ver Mensaje Individual
  #3 (permalink)  
Antiguo 21/02/2014, 04:56
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

Perdón el php estaba mal hecho:

Código PHP:
$result mysql_query("SELECT * FROM detalle_factura_mc where id_aviso = '".$_POST['id_aviso']."'"$link); 
if (
$row mysql_fetch_array($result)){ 

while (
$field mysql_fetch_field($result)){ 
            echo 
"<td>$field->name</td> \n"

           
do { 
            echo 
"<form method='POST' name='form10' id='form10'> \n";
            echo 
"<table width='100%' > \n"
            echo 
"<tr> \n";
            echo 
"<td><input type='text' name='almacen' id='almacen' size='2' ></td>\n"
            echo 
"<td><input type='text' value=".$row["recambio"]." size='10' ></td>\n"
            echo 
"<td><input type='text' value=".$row["denominacion"]." size='25' ></td>\n"
            echo 
"<td><input type='text' value=".$row["cantidad"]." size='5' ></td>\n"
            echo 
"<td><input type='text' value=".$row["pvp"]." size='5'></td>\n"
            echo 
"<td><input type='text' size='5'  value=".$row["descuento"]." ></td>\n"
            echo 
"<td><input type='text' value=".$row["pvp_total"]." size='5' ></td>\n"
            echo 
"<td><img src='imagenes_menu/modificar.jpeg' id='mod10' width='20' height='20' style='cursor:pointer' /></td> \n"
            echo 
"<td><img src='imagenes_menu/cancelar.png' id='del10' width='20' height='20' style='cursor:pointer' /></td> \n";
            echo 
"<td><input type='hidden' name='MM_update' value='form10' /></td> \n";
            echo 
"</tr> \n";
            echo 
"</table> \n";
            echo 
"</form> \n";
        
            
         } while (
$row mysql_fetch_array($result)); 
           
    
} else { 
echo 
"¡ No se ha encontrado ningún registro !"



Al pulsar aquí:

Código Javascript:
Ver original
  1. echo "<td><img src='imagenes_menu/modificar.jpeg' id='mod10' width='20' height='20' style='cursor:pointer' /></td> \n";



Quiero que me haga esto:

Código Javascript:
Ver original
  1. <script type="text/javascript">
  2. $(document).ready(function() {
  3.    
  4.     $("#mod10").click(function(){
  5.        
  6.  
  7.       $("#form10").trigger("submit");
  8.        });
  9.    
  10.  
  11.     $('#form10').submit(function(event) {
  12.      var datos = $(this).serialize();  
  13.       event.preventDefault()
  14.       $.ajax(
  15.         {
  16.             url:'update_recam.php',
  17.             type:'POST',
  18.             data:datos,
  19.             beforeSend:function(objeto){
  20.                 $('#carga').css({display:'block'});
  21.             },
  22.             complete:function(){
  23.                 $('#carga').css('display','none');
  24.                 },
  25.             success: function(data) {
  26.                 $('#result3').html(data);
  27.    
  28.             }
  29.         });
  30.     });
  31. });
  32. </script>

Última edición por satjaen; 21/02/2014 a las 09:31