I am attempting to display a "loading" gif while my AJAX request is being processed. Below are the functions I am using:
beforeSend: function () {
$('.form-sending-gif').show();
console.log("The beforeSend function was called");
}
and
complete: function () {
$('.form-sending-gif').hide();
console.log("The complete function was called");
}
The console.log
statements are for testing purposes. Despite confirming that both functions are running, the image is not displaying or hiding as expected. I have checked with $('.form-sending-gif').show()
in the console and it works correctly. The image is supposed to be shown on page load.
What could be the issue here?