My controller:
class SchoolController < ApplicationController
def index
...
end
def edit
@school=School.find_by_id params[:id]
end
def check_teachers
@teachers = @school.teachers
#How to show teachers' names and titles in a lightbox by javascript ?
end
end
As you see above, I have a check_teachers method, inside which I got a list of teachers objects. Each Teacher object has name and title attributes.
A button click on the view will trigger the check_teachers method get called:
I would like to show all teachers name and title in a lightbox. I think I would need javascript to implement this. But I don't know how can I pass all the teachers' data from Rails to javascript and show the data in a js implemented lightbox...
Anyone can provide any help on this?