Created
September 19, 2011 14:07
-
-
Save daGrevis/1226567 to your computer and use it in GitHub Desktop.
Spinner/loader in specified place before AJAX request (shows only if request has taken more than X milliseconds)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//var i, interval_id; | |
//var interval_id; | |
var timeout_id; | |
//i = 0; | |
//interval_id = setInterval(function() { | |
timeout_id = setTimeout(function() { | |
// ++i; | |
// if (i == 1000) { | |
$('.place_for_spinner').html('...'); | |
// } | |
//}, 1); | |
}, 1000); | |
$.post('over/the/rainbow', function() { | |
// clearInterval(interval_id); | |
clearTimeout(timeout_id); | |
$('.place_for_spinner').remove(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment