I’ve been attempting to implement a spinner image while loading ajax data, but I can't seem to get it to work. Here's my code :
$.ajax({
url: '/Observer/GetInfoProfileByProfileId',
type: 'POST',
data: {
ProfileId: profileId,
},
beforeSend: function() {
console.log('spinner shown');
$('#spinner').css('display', 'block');
},
complete: function() {
console.log('spinner hidden');
$('#spinner').css('display', 'none');
},
success: function(response) {
//..do something with response
}
});
Could someone kindly point out what might be the issue with the above code? Any help would be greatly appreciated.