Last active
June 5, 2018 21:30
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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