Is there a way that when your loading content to display the loading div for
a minimum amount of time?
 
I am requesting Ajax grab some content for me and while its doing so I show
the loading spinner but in some cases it just flashes for a millisecond and
gone. Can it be set to show for a minimum length of time?
 
$("a.add").click(function (){
           
 var url_id = $(this).attr("href");
 var div_id = url_id.substr(1).replace( new RegExp( "/" ,"g"), "_" );

 $('#' + div_id).after('<div class="loading"></div>');
  $('.loading').fadeIn('normal');
  $.ajax({
     type: "GET",
     url: url_id,
     cache: true,
     success: function(response){
      $('.loading').fadeOut('normal').remove();
      $('#' + div_id).html(response).slideToggle('slow');
      }
   });
 return false;
 });

Thanks
 
Dave

Reply via email to