I use the following code snippet for user login through Ajax.
$("#login_ajax").submit(function () {
$("#header-login").fadeOut('fast', function() {
$(this).html("Loading").fadeIn('fast');
});
$.post("db/login.php",
{ username: $("#username").val(), password: $("#password").val() },
function(data) {
$("#header-login").fadeOut('fast', function() {
$(this).html(data).fadeIn('fast');
});
});
return false;
});
My problem is that my request is being processed so fast, the fading effects overlap with each other, and I'm just stuck with "Download", even if the request returns some data to display. Am I doing it wrong?
I cannot use jQuery ajaxStart and ajaxStart because I use other forms of ajax on my site and do not want them to run Download
thank you for your time
source
share