Skip to content

Instantly share code, notes, and snippets.

@mvark
Last active June 5, 2018 21:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvark/92478ce44c3ddde0b100 to your computer and use it in GitHub Desktop.
Save mvark/92478ce44c3ddde0b100 to your computer and use it in GitHub Desktop.
Transform JSON field names in feed to match FullCalendar jQuery plugin's Event format
$(document).ready(function() {
$('#calendar').fullCalendar({
defaultDate: '2014-11-13',
editable: true,
eventLimit: true, // allow "more" link when too many events
events: function (start, end, timezone, callback) {
$.ajax({
url: "http://example.azure-mobile.net/tables/event?$filter=eventdate gt '" + start.toISOString() + "' and eventdate lt '" + end.toISOString() + "'",
dataType: 'json',
beforeSend: setHeader,
success: function (data) {
var events = [];
$.each(data, function (index) {
events.push({
"title": data[index].item,
"start": data[index].bestbefore
});
});
callback(events);
},
error: function () { alert('Failed!'); },
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment