I'm a little new to jQuery framework and while using AJAX with normal javascript I used readyState()
function to display a loading gif image. But, I don't know how to use that in jQuery .post()
method. Was it possible to add a class until it finishes loading? If so, please give a code sample. My function is similar to this:
$.post("verify.php",{
username: u,
password: p
},function(r) {
if(r == 1) {
$(".elmt").addClass("loading");
} else if (r == 0) {
location.href = 'http://localhost';
}
});