Ver Mensaje Individual
  #15 (permalink)  
Antiguo 11/10/2012, 11:57
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 7 meses
Puntos: 10
Respuesta: Imagen animada al llamar al servidor

He puesto esto:

Código Javascript:
Ver original
  1. function filtrar()
  2.  
  3. {
  4.  
  5.        $.ajax({
  6.  data: $("#frm_filtro").serialize()+ordenar,
  7.  type: "POST",
  8.  dataType: "json",
  9.  url: "ajax.php?action=listar",
  10.  beforeSend: function(){
  11. $('.carga').html("<img src='imagenes_menu/ajax-loader3.gif' align='center' /><br /> Aguarde por favor...");
  12.  },
  13. success: function(data){
  14.         var html_user ='' ;
  15.         if(data.length > 0){
  16.         $.each(data, function(i,item){
  17.        
  18.        
  19.          
  20.  html_user += '<tr ondblclick="pulsar(this, ' +  String.fromCharCode(39) + item.num_usuario + String.fromCharCode(39)  + ');" >';
  21.  html_user += '<td ><input name="demo" type="radio" value="' + item.num_usuario + '"/></td>';
  22.  html_user += '<td id="row0" >'+item.num_usuario+'</td>';
  23.  html_user += '<td>'+item.telefono+'</td>';
  24.  html_user += '<td>'+item.nombre+' '+item.apellidos+'</td>';
  25.  html_user += '<td>'+item.poblacion+'</td>';
  26.  html_user += '</tr>';
  27.            
  28.                                  
  29.         });                    
  30.     }
  31.     if(html_user == '') html_user = '<tr><td colspan="4" align="center">No se encontraron registros..</td></tr>';
  32.     $("#data tbody").html(html_user);
  33.      // OCULTAS LA IMAGEN
  34.  // ACA PUEDES MOSTRAR UN TEXTO DICIENDO QUE YA CARGO LA DATA
  35.  // ESTO LO PUEDES PONER UNA VEZ HAYA CARGADO EL AJAX O CUANDO HAYAS LISTADO TODOS LOS ELEMENTOS
  36.  $('.carga').html('CARGO COMPLETAMENTE');
  37.  },
  38. error: function(){
  39.  // ACA PUEDES MOSTRAR UN TEXTO DICIENDO EL ERROR QUE YA CARGO TU DATA
  40.   $('.carga').html('ERROR AL CARGAR COMPLETAMENTE');
  41. }
  42.  });
  43.     }


Código HTML:
Ver original
  1. <table width="100%" id="data" class="table-dg-grid" >
  2.              <thead>
  3.               <tr>
  4.           <th><div id="carga"></div></th>
  5.           <tr bgcolor=#DFEBFF id=t70 ondblclick='coloreaf(70,1)' onMouseOver='coloreamosin(70,1)' onMouseOut='coloreamosout(70,1)'>
  6.           <th><span title="selecc">Selecc.</span></th>
  7.           <th><span title="nu_usuario">Nº Usuario</span></th>
  8.           <th><span title="telefono">Teléfono</span></th>
  9.           <th><span title="nombre">Nombre</span></th>
  10.           <th><span title="poblacion">Población</span></th>
  11.              </tr>
  12.             </thead>
  13.                 <tbody>
  14.                 </tbody>
  15.             </table>


Pero sigue sin sacarme la imagen animada