I've this code for my AJAX script
$(document).ready(function() {
$("#submit").click(function(){
var acc = $("#accountNumber").val();
src = "pass.php";
$.ajax({
url: src,
data: 'action=account&type=viewDetail&accNo='+acc,
cache: false,
type:'GET',
success: function(data, textStatus, XMLHttpRequest){
if(data!=0) {
// alert(data);
$("#userInfo").html("");
$("#userInfo").css("display","block");
$("#userInfo").append(data);
}else {
$("#userInfo").html('');
$("#userInfo").append('<span class="alert-red alert-icon">Please Enter correct Account Number.</span>');
$("#userInfo").css("display","block");
}
},
error:function(XMLHttpRequest, textStatus, errorThrown){alert(textStatus); alert(errorThrown);}
});
});
});
This scripts loads data from server and while I want to retrieve another account information it takes time. So I want to display some spinner while the data being fetched.
Anybody could help?