0
votes

How do I send additional options to the events json feed for full calendar?

I can set events as a JSON feed:

$('#calendar').fullCalendar({
    events: '/myfeed.php'
});

and FullCalendar has an option to send additional data via a POST:

$('#calendar').fullCalendar({

    events: {
        url: '/myfeed.php',
        type: 'POST',
        data: {
            custom_param1: 'something'
        },
    }
});

But this changes the GET query which look like:

/myfeed.php?start=2013-12-01&end=2014-01-12&_=1386054751381

Into a POST which is only sending my custom param - it doesn't send the start/end/_id

The documentation states that the startParam and endParam are additional options for JSON feeds, but what value do I give these?

1

1 Answers

0
votes

From the documentation (jQuery $.ajax options):

You can also specify any of the jQuery $.ajax options within the same object! This allows you to easily pass additional parameters to your feed script, as well as listen to ajax callbacks

So, you need to use the correct $.ajax options, specifically the type property. You should use GET:

$('#calendar').fullCalendar({

    events: {
        url: '/myfeed.php',
        type: 'GET',
        data: {
            custom_param1: 'something'
        },
    }
});

This performs a $_GET request with the following format:

/myfeed?custom_param1=something&start=2015-04-26&end=2015-06-07&_=1432680911380