I'm using Rails UJS to load partials into a container depending on the link I click. I've got everything working (see my answer to my question here for code) but I'd like to add a spinner while the content is loading. How can I go about doing this? I found a brief example in Simone Carletti's post on UJS but can't seem to implement it properly.
Here's the HTML generated:
<div id="tabs">
<ul id="infoContainer">
<li><a href="/profiles/1/profile_reviews" class="active" data-remote="true" id="profile_loader">Reviews</a></li>
<li><a href="/profiles/1/profile_about" class="inactive" data-remote="true" id="profile_loader">About</a></li>
<li><a href="/profiles/1/profile_credits" class="inactive" data-remote="true" id="profile_loader">Credits</a></li>
<li><span id="loading">Loading...</span></li>
</ul>
<div id="tabs-1">
# load data from partials here
</div>
</div>
Can anyone help me out?