views:

13

answers:

0

I am trying to display a waiting spinnger, while uploading a file. I am able to show the spinner, and to do the upload, when doing it individually. My problem is how to combine these two.

The Jquery Javascript looks like:

<% javascript_tag do %>
function showLoading() {
  $("#loading").show();
}
function hideLoading() {
  $("#loading").hide();
}
function submitCallback() {

showLoading(); $.post("create"); } <% end %>

My form looks like:

<% semantic_form_for @face, :html => {:multipart => true}  do |f| %>
  <%= f.error_messages %>
  <%= render  'fields', :f => f %>
  <p>
    <%= button_to_function 'create', "submitCallback()" %>
  </p>
 <% end %>