Hi Colin,
Sure!
This is the whole thing (including alerts to let me know when clicks are
handled):
<script>
var AUTH_TOKEN = $('meta[name=csrf-token]').attr('content');
$(document).ready(function()
{
$('#calendar').fullCalendar(
{
minTime: "08:00:00",
maxTime: "20:00:00",
eventRender: function (event, element) {
element.click(function() {});
},
eventClick: function(calEvent, jsEvent, view) {
alert('Clicked on: ' + calEvent.format());
},
dayClick: function(date, jsEvent, view) {
alert('You Clicked on: ' + date.format());
// $.post('/lockout/'+date.format())
$.ajax({
url: '/lockout/'+date.format(),
type: 'post',
dataType: "html",
data: "&authenticity_token="+AUTH_TOKEN,
success: function(){alert('SUCCESS');},
error: function()
{
alert('error posting date');
}
});
},
events:
{
url: '/populate_events',
type: 'GET',
error: function()
{
alert('there was an error while fetching events!');
}
},
fixedWeekCount: false,
header:
{
left: 'month,agendaWeek',
center: 'title',
right: 'today prev,next'
}
});
$('#calendar').fullCalendar('option', 'aspectRatio', 2.2);
});
</script>
It's not very complicated. The alert "You clicked on..." always occurs
when it is supposed to, and the alert('SUCCESS') occurs immediately
thereafter.
The alert('error posting date') only occured when I messed up the
routing, earlier in my development,
Thanks,
Don