There are开发者_JAVA百科 two models: Exams and Resources.
Every each exam could has many Resources
Routes.rb
resources :exams do
resources :resources
end
I want to get asynchronously all resources belongs to particular Exam. That should be realising in exam controller, yes?
But there's another problem, how should I send ajax request? I need to make it on_succes of another Ajax request (adding resource at the particular exam page). It is done by form_for with :remote, json returned by controller and js (jquery) file wich registers callbacks for ajax states.
Here are sources, An Ajax Branch.
Summary: I can add a resource to an exam (at /exams/:id) with Ajax but i want to reload Exam.resources when first Ajax is finished.
Please, Help me!
I did that.
Just returning json'ed @resource (which was just added) and inject it to page via jquery when ajax request is successed
精彩评论