Reputation: 255
I'm using the jQuery FullCalendar plugin with Ruby on Rails, and now I want to show the event details in a jquery dialog when you click on an event in the calendar. I have this in my controller EventsController
# GET /events/1
# GET /events/1.xml
def show
@event = Event.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @event }
format.js { render :json => @event.to_json }
end
end
which works as intended if I visit the url /events/1 for example. Then I see the form generated in app/views/events/show.html.erb. However, in my calendar.js where I'm trying to GET that form and insert it into my dialog div with this code:
// http://arshaw.com/fullcalendar/docs/mouse/eventClick/
eventClick: function(event, jsEvent, view){
$.get('/events/' + event.id, function(data, text, jqXhr) {
eventdialog.html(data);
eventdialog.dialog("open");
});
},
'data' only contains the JSON-data. Sorry if this is a nooby question, but i've tried googling for hours now but I can't seem to find what i'm looking for. Using RoR 3.2.2.
Upvotes: 0
Views: 348
Reputation: 19408
Last line should be like format.js { render :partial => 'event' }
Upvotes: 1