Skip to content

Instantly share code, notes, and snippets.

@coderforhire
Created February 7, 2012 22:27
Show Gist options
  • Save coderforhire/1762575 to your computer and use it in GitHub Desktop.
Save coderforhire/1762575 to your computer and use it in GitHub Desktop.
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
droppable: true, // this allows things to be dropped onto the calendar !!!
drop: function(date, allDay) { // this function is called when something is dropped
// retrieve the dropped element's stored Event Object
var originalEventObject = $(this).data('eventObject');
// we need to copy it, so that multiple events don't have a reference to the same object
var copiedEventObject = $.extend({}, originalEventObject);
// assign it the date that was reported
copiedEventObject.start = date;
copiedEventObject.allDay = allDay;
alert("Dropped on " + date + "Event:" + copiedEventObject.title);
@coderforhire
Copy link
Author

         $.post("/events", { name: copiedEventObject.title, start_at: copiedEventObject.start, end_at: copiedEventObject.start },
                        function(data) {
                alert("Data Loaded: " + data);
                                    });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment