Ver Mensaje Individual
  #3 (permalink)  
Antiguo 08/10/2012, 02:40
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

Como puedo incluir la funcion loader:

Código Javascript:
Ver original
  1. $(document).ready(function(){
  2.   $("div").ajaxStart(function(){
  3.     $(this).html("<img src='demo_wait.gif' />");
  4.   });
  5.   $("button").click(function(){
  6.     $("div").load("demo_ajax_load.asp");
  7.   });
  8. });

En mi cod, donde tengo un formulario con un boton donde filtro los datos:

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.         success: function(data){
  11.         var html_user ='' ;
  12.         if(data.length > 0){
  13.         $.each(data, function(i,item){
  14.        
  15.        
  16.          
  17.  html_user += '<tr ondblclick="pulsar(this, ' +  String.fromCharCode(39) + item.num_usuario + String.fromCharCode(39)  + ');" >';
  18.  html_user += '<td ><input name="demo" type="radio" value="' + item.num_usuario + '"/></td>';
  19.  html_user += '<td id="row0" >'+item.num_usuario+'</td>';
  20.  html_user += '<td>'+item.telefono+'</td>';
  21.  html_user += '<td>'+item.nombre+' '+item.apellidos+'</td>';
  22.  html_user += '<td>'+item.poblacion+'</td>';
  23.  html_user += '</tr>';
  24.            
  25.                                  
  26.         });                    
  27.     }
  28.     if(html_user == '') html_user = '<tr><td colspan="4" align="center">No se encontraron registros..</td></tr>';
  29.     $("#data tbody").html(html_user);
  30. }
  31.  
  32.            
  33.       });
  34. }