开发者

rails running methods after view is loaded

开发者 https://www.devze.com 2023-03-23 21:09 出处:网络
I would like to show a spinning \'loading\' image whil开发者_StackOverflow社区e my method computes some things and returns the results to the view.

I would like to show a spinning 'loading' image whil开发者_StackOverflow社区e my method computes some things and returns the results to the view.

Currently, it just looks as though the page isn't loading at all and then does (it's performing the method).

Any ideas?


One approach would be for the page you're loading to simply be the loading indicator, and have it do an AJAX request to retrieve the rest of the results (you can use jQuery or something similar to issue the request and then insert the results into the document).

If you're feeling up to it, you could instead use the HTTP streaming support that's new in Rails 3.1.

http://railscasts.com/episodes/266-http-streaming

0

精彩评论

暂无评论...
验证码 换一张
取 消