Ver Mensaje Individual
  #13 (permalink)  
Antiguo 10/10/2012, 09:21
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: Condicion para que salga imagen Loading

Gracias a todos, he puesto esta function CargarDatos delante pero no se si da tiempo a salir la imagen, es como si no hiciera nada?
El id de la capa donde salen los registros es data y no se si lo estoy haciendo bien.
Le podeis echar un vistazo por favor?

Código Javascript:
Ver original
  1. function CargarDatos(data) {
  2. var
  3. ajax;
  4. ajax = ajaxFunction();
  5. ajax.open("POST", true);
  6.  
  7. ajax.setRequestHeader("Content-Type",
  8. "application/x-www-form-urlencoded");
  9. ajax.onreadystatechange = function()
  10. {
  11.  
  12. if (ajax.readyState==1){
  13. document.getElementById(data).innerHTML = "<img src='menu_imagenes/ajax-loader3.gif' align='center' /><br /> Aguarde por favor...";
  14. }
  15.  
  16.  
  17. if (ajax.readyState == 4){
  18.  if(ajax.status == 200) {
  19. document.getElementById(data).innerHTML =
  20. ajax.responseText;
  21. }
  22. }}
  23. ajax.send(null);
  24. }
  25. function filtrar()
  26. {  
  27.         $.ajax({
  28.         data: $("#frm_filtro").serialize()+ordenar,
  29.         type: "POST",
  30.         dataType: "json",
  31.         url: "ajax.php?action=listar",
  32.         success: function(data){
  33.         var html_user ='' ;
  34.         if(data.length > 0){
  35.         $.each(data, function(i,item){
  36.        
  37.        
  38.          
  39.  html_user += '<tr ondblclick="pulsar(this, ' +  String.fromCharCode(39) + item.num_usuario + String.fromCharCode(39)  + ');" >';
  40.  html_user += '<td ><input name="demo" type="radio" value="' + item.num_usuario + '"/></td>';
  41.  html_user += '<td id="row0" >'+item.num_usuario+'</td>';
  42.  html_user += '<td>'+item.telefono+'</td>';
  43.  html_user += '<td>'+item.nombre+' '+item.apellidos+'</td>';
  44.  html_user += '<td>'+item.poblacion+'</td>';
  45.  html_user += '</tr>';
  46.            
  47.                                  
  48.         });                    
  49.     }
  50.     if(html_user == '') html_user = '<tr><td colspan="4" align="center">No se encontraron registros..</td></tr>';
  51.     $("#data tbody").html(html_user);
  52. }
  53.  
  54.            
  55.       });
  56. }

Gracias.