Ver Mensaje Individual
  #4 (permalink)  
Antiguo 05/06/2010, 01:30
clico
 
Fecha de Ingreso: enero-2010
Mensajes: 26
Antigüedad: 14 años, 4 meses
Puntos: 0
Respuesta: el id del boton es una variable cogida de base de datos

Cita:
Iniciado por mayid Ver Mensaje
con $(this)

Podes publicar tu funcion por favor?

ej:
Hola mayid, perdón por el retraso estuve de viaje.

Mira mi script es el siguiente:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<script src="jquery-1.4.2.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
$("#boton").click(function(){
$.post("guardar_boton.php", $("#form1").serialize());
});

});
</script>
</head>

<body>
<?php

$conexion=mysql_connect("localhost","usuario","con traseña");

mysql_select_db("prueba_ajax",$conexion);
$result = mysql_query("select * from ajax",$conexion);
while ($row=mysql_fetch_array($result))
{
?>

<table width="50%" border="5" cellspacing="0" cellpadding="0">
<tr>
<td><form id="form1" name="form1" method="post" action="">
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="113"><input name="id" type="text" id="id" value="<?php echo $row['id']; ?>" /></td>
<td width="113"><input name="nombre" type="text" id="nombre" value="<?php echo $row['nombre']; ?>" /></td>
<td width="115"><input name="boton" type="submit" id="boton" value="<?php echo $row['gustos']; ?>" /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<p>
<?php } ?>
</body>

Te explico, intento conseguir el efecto de Facebook cuando se pulsa el botón "Me gusta"..."Ya no me gusta".

Cuando envío los datos a la página "guardar_boton.php" sólo me hace el cambio con el primer elemento de la tabla el resto me los deja igual.

A ver si me puedes ayudar. Gracias !!!!