Im using jQuery validation plugin http://docs.jquery.com/Plugins/validation to do some client side validations.
I have a remote validation to check whether a username is available in the database, and I would like my spinner to hang about for maybe a second longer than the request will take, to prevent the sudden flash of the spinner appearing/disappearing when the responce is very quick.
The code I am using to handle the spinner is as follows:
$(document).bind("ajaxStart.mine", function() {
$('#myloader').show();
});
$(document).bind("ajaxStop.mine", function() {
$('#myloader').hide();
});
Any suggestions?
You can add "delay" to hide animation
$(document).bind("ajaxStart.mine", function() {
$('#myloader').show();
});
$(document).bind("ajaxStop.mine", function() {
$('#myloader').delay(5000).hide('slow');
});