what is a good introduction to AJAX in Ruby On Rails?
I need some good introductory pointers to AJAX in the context of a Ruby On Rails app.
Here's the scoop: My app spins off several tasks using Delayed::Job. While the tasks are busy sprunging data from external sites, I want to keep the user appraised of their progress. I don't want to refresh the entire page -- just a rectangle on the page where each task can display status messages.
I don't believe I need a full push technology -- it is sufficient to u开发者_Python百科se javascript-initiated polling to update the screen as long as bg tasks are running.
That's an appropriate scenario for AJAX (right?), and I think Rails3 has specific constructs to support AJAX-y interactions with browsers (right?). Ryan Bates's Railscast on Polling For Changes is a good template for this specific case, but I'd like a better understanding of what's really going on under the hood. Okay, then where do I get started?
For what it's worth, I'm already using jQuery in my Rails3 app.
Just like numbersblah said you need a memory queue. Take a look at apache activemq. It might just do what you need.
RailsCasts.com is a really great resource:
http://railscasts.com/episodes?utf8=%E2%9C%93&search=ajax
Rails Guides is another great resource: http://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html
精彩评论