I'm having trouble displaying a spinner in a Rails 3.2 app that uses jQuery.
Entering site/assets/javascripts/application.js displays the code below so I know it is loading.
Updated with feedback - In my assets/javascripts/site.js:
$(document).ready(function() {
$("#change_item").change(function() {
$("#spinner").show();
var item_id = $(this).val();
var url = "/system/" + item_id + "/change_item/";
$.post(url, item_id, function(html) {
$("#spinner").hide();
window.location.reload(true);
});
});
});
The pull down menu:
<%= select_tag "current_item", options_from_collection_for_select(current_user.accessible_items, "id", "name", session[:item]), :id=>"change_item" %>
In my layout file:
<div id = "spinner" style = "display:none;"><%= image_tag "spinner.gif" %></div>
I've compared what I'm doing to numerous Google results but am having trouble determining what I'm doing wrong.
Thanks.