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 originalecho "<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<script type="text/javascript">
$(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>