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$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' name='recambio' value='" . $row['recambio'] . "' size='10' /></td>\n";
echo "<td><input type='text' name='denominacion' size='25' value='" . $row['denominacion'] . "' /></td>\n";
echo "<td><input type='text' name='cantidad' value='".$row["cantidad"]."' size='5' /></td>\n";
echo "<td><input type='text' name='pvp' value='".$row["pvp"]."' size='5' /></td>\n";
echo "<td><input type='text' name='descuento' size='5' value='".$row["descuento"]."' /></td>\n";
echo "<td><input type='text' name='pvp_total' 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='id_fact' value=".$row['id_fact']." /></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 !";
}
}
}
?>
<script>
$(document).ready(function() {
$("#mod10").click(function(){
$("#form10").trigger("submit");
});
$('#form10').submit(function(event) {
var datos = $(this).serialize();
event.preventDefault()
$.ajax(
{
url:'update_recam.php',
type:'POST',
data:datos,
beforeSend:function(objeto){
$('#carga').css({display:'block'});
},
complete:function(){
$('#carga').css('display','none');
},
success: function(data) {
$('#result3').html(data);
}
});
});
});
</script>