views:

570

answers:

2

I want to use events (as a function) in my calendar. The example listed refers to myxmlfeed.php and using xml. I have tried adding some xml but I return a js error. has anybody used FullCalendar in this way?

http://arshaw.com/fullcalendar/docs/event_data/events_function/

+2  A: 

I am using FullCalendar with events as a function on one of my client's websites. The implementation of FullCalendar there is heavily customized, but the code below is what I use to load the calendar JSON data.

<script type='text/javascript'>
    $(document).ready(function() {
        $('#calendar').fullCalendar({
            events: function(start, end, callback) {
                $.post("calendar_data.asp", {
                    start: start.getTime() / 1000,
                    end: end.getTime() / 1000,
                    catID: '<% Response.Write(catID) %>'
                }, function(result) { callback(result) }, "json");
            },
            loading: function(bool) {
                if (bool) $('#loading').show();
                else $('#loading').hide();
            },
        });
    });
</script>

If you note my call to $.post() I am passing a "catID" with the request to calendar_data.asp. This is an implementation detail specific to my code; you will most likely need to customize this to your specific requirements.

Edit

I'm not entirely sure if this will work with the most current version of FullCalendar. It has been a while since I implemented my solution and the library has changed somewhat.

Nathan Taylor
A: 

Thanks for your answer Nathan and I might actually use some of that but it was the actual xml file that is being called that I was looking for an example of rather than the json array.

I was guessing it might be something like

<event start="" title="" />

John DOnovan