Adding a loading spinner while waiting for the AJAX request to complete