I've been attempting to store a JSON file within a specific folder in my .NET project called /Content/events/events.json
. My goal is to then retrieve this file using an AJAX call and incorporate it into the Fullcalendar add-on, specifically for the events:
field.
Here's what I've tried so far:
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month'
},
defaultDate: 'new Date()',
editable: true,
events: {
url: '/Content/events/events.json',
type: 'GET',
dataType: 'json',
data: {
},
error: function () {
alert('there was an error while fetching events!');
}
},
eventRender: function (event, element) {
//other code stuff
}
});
Despite multiple attempts, I keep encountering a GET 404 error
. Currently, I'm testing this on localhost through Visual Studio debugging with plans to deploy it online once everything works seamlessly. How can I successfully make an AJAX call to fetch the required JSON file for the events:
parameter?
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:56087/Content/events/document.json?start=1404014400&end=1407643200&_=1406577499130
Visit Fullcalendar Site
I've also attempted their GitHub method without success, hence my decision to try accessing the information from a local or server-side file. While I can hardcode the events
like this,
...
events:
[
{
title: 'Bi-weekly Meeting',
start: '2014-07-09',
color: 'red'
}
],
...
This approach requires manual editing of the source code each time I want to modify any events. Ideally, I'd like to allow modifications to be made to this JSON file externally from the application, enabling myself and other users to easily update the events as needed.