Ver Mensaje Individual
  #4 (permalink)  
Antiguo 05/11/2010, 16:10
Dany_s
 
Fecha de Ingreso: diciembre-2009
Ubicación: Misiones
Mensajes: 867
Antigüedad: 14 años, 5 meses
Puntos: 65
Respuesta: jquery, esperar antes de ejecutar el click ...

Lo que se me ocurre es
con settimeout, le decis que en x cantidad de milisegundos se ejecute una función que va a ser la llamada, pero antes anular el identificador

Código HTML:
Ver original
  1.     <head>
  2.         <title>Ejemplon</title>
  3.         <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  4.     </head>
  5.         <script type="text/javascript">
  6.            
  7.             $( function (){
  8.                 var identificador;
  9.                 $('input').change( function(){
  10.                     $('#respuesta').html("Esperando datos...");
  11.                     clearTimeout(identificador);
  12.                     identificador = setTimeout("traeDatos()",3000);
  13.                 });
  14.             });
  15.            
  16.             function traeDatos(){
  17.                 $.ajax({
  18.                     url: 'x.php?'+$('input').serialize(),
  19.                     success: function(data) {
  20.                         $('#respuesta').html(data);
  21.                     }
  22.                 });
  23.             }
  24.  
  25.         </script>
  26.     <body>
  27.  
  28.         1: <input type="checkbox" name="valor[]" value="1" />
  29.         2: <input type="checkbox" name="valor[]" value="2" />
  30.         3: <input type="checkbox" name="valor[]" value="3" />
  31.         4: <input type="checkbox" name="valor[]" value="4" />
  32.         5: <input type="checkbox" name="valor[]" value="5" />
  33.         6: <input type="checkbox" name="valor[]" value="6" />
  34.         <div id="respuesta"></div>
  35.     </body>
  36. </html>

en mi x.php
Código PHP:
Ver original
  1. <?php
  2. $salida = 'Valores elegidos:<br />';
  3. foreach ($_GET['valor'] as $value) {
  4.     $salida .= $value . "<br />";
  5. }
  6. echo $salida;
  7. ?>