allow waiting user experience while file upload with rails and jquery

Posted by poseid on Stack Overflow See other posts from Stack Overflow or by poseid
Published on 2010-06-08T17:08:15Z Indexed on 2010/06/08 17:12 UTC
Read the original article Hit count: 169

Filed under:
|

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 %>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ruby-on-rails