Saraswathy Renuga
Saraswathy Renuga

Reputation: 182

In Ruby on rails, how to show loading image till an action completes executing?

I have an application, where users will be redirected to our site from a parent website. We will be getting the user's details by SAML process. Based on the details received, if the user is new user,the user will be created. So the action sessions/consume takes some time to process.Is it possible to show a loading image or any image until the action completes? So that users will not see blank screen.

Upvotes: 2

Views: 1721

Answers (2)

user1070712
user1070712

Reputation: 11

The simple way is using jquery in rails.In Rails after submitting form if u want to show loader till action completes.. below is the simple example:: <script type="text/javascript"> $("#me").click(function(){ $("#img").css("display","block"); }); </script> <%=submit_tag "Approve",:id=>"me"%> <p id="img" style="display:none;"><%= image_tag 'loader2.gif' %></p>

Upvotes: 1

Alex D
Alex D

Reputation: 30455

There are a couple ways you can do this. I think the easiest would probably to use JavaScript on the client side to make the "loading..." image appear when the user clicks on the link.

Upvotes: 3

Related Questions