KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm using the following mockup to show my loading spinner while doing AJAX requests in my jQuery code: jQuery.ajaxSetup({ beforeSend: function() { $('#loader').show() }, complete: function(){ $('#loader').hide() }, success: function() { $('#loader').hide() } }); This code works perfectly fine for me! Just one problem: Some requests are just very simple and fast, so the loading spinner is just shown for a couple of millisecs. That of course isn't very pretty. So I tried using setTimeout() to display the loading spinner slightly delayed. I want it to only pop up if the AJAX requests takes at least, let's say 100ms, but it didn't work. So I need some code to delay the loading spinner as I explained above, so it ONLY pops up while doing "longer" AJAX requests!
Tags (comma-separated)
Save Edits
Cancel