Ver Mensaje Individual
  #7 (permalink)  
Antiguo 18/02/2014, 12:25
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: Enviar formulario con evento onblur

Alexis, no he dudado de tu código sino del mio. Es que no me funciona, escribo algo en el textarea y no hace nada. La tabla es para el ejemplo. Gracias por tu consejo.

Código Javascript:
Ver original
  1. <html xmlns="http://www.w3.org/1999/xhtml">
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
  5. <title>mi bug</title>
  6. </head>
  7. <script type="text/javascript" >
  8. $("#formulario").submit(function(e){
  9.     e.preventDefault();
  10.     $.ajax({
  11.         url: $(this).prop("action"),
  12.         data: $(this).serialize(),
  13.         success: function(response){
  14.            $("#contenido").html(response);
  15.         }
  16.     });
  17. });
  18.    $("#salida").blur(function(){
  19.     $("#formulario").trigger("submit");
  20. });
  21. </script>
  22. <style>
  23. .carga1{
  24. cursor:pointer;border-radius:10px;-moz-border-radius:10px;-webkit-border-radius:10px;background-repeat: no-repeat;background-position:center;background-size:30%;background-color:rgba(0,0,0,0.5);width:300px;color:#fff;text-align:center;height:100px;padding:52px 12px 12px 12px;position:fixed;top:30%;left:40%;z-index:6;
  25. }
  26. </style>
  27.  
  28. <body>
  29. <form id = "formulario" action = "ins1_avisos.php">
  30.   <table width="79%">
  31.             <tr>
  32.               <th scope="col" width="57">Teléfonos</th>
  33. <th scope="col" width="52"><input name="telefonos" id="telefonos"  type="text" size="9" maxlength="9"/></th>
  34.  
  35.              <th scope="col" width="46">Nombre</th>
  36.     <th scope="col" width="88"><input name="name" id="name" type="text" size="35"/>
  37.               </th>
  38.               <th scope="col" width="46">Apellidos</th>
  39.   <th scope="col" width="403"><input name="apellidos" id="apellidos" type="text" size="20" /></th>
  40.  
  41.     <th scope="col"><textarea id = "salida"></textarea></th>
  42.             </tr>
  43.            
  44.            
  45. </table>
  46. <input type="hidden" name="MM_insert" value="form1" />
  47.  
  48. </form>
  49. <div id="contenido" class="carga1"></div>
  50. </body>
  51. </html>