0
votes

Hello everyone!

Im using Fullcalendar in version 1.6.4 combinated with php and mysql. My only source for events is Mysql database where I have start time, end time, etc for any event.

I want that user don't have to reload page every second to see if any events has been added.

I found methods called refetchEvents and rerenderEvents. But if I use them, the calendar has no reaction.


1# Ajax call

Here is my ajax call to add event to the database:

$( document ).ready(function() {
        $("#pridat_akci").click(function() { 
        var procedura = $.cookie('kontrola_procedury');
        var start = $.cookie('datum')+' '+$.cookie('formDate');
        var lpg = $.cookie('lpg_check');
        var oboje = $.cookie('navazujici');
        var info = $.cookie('clovek_info');        
        var typ_paliva = $.cookie('typ_paliva');
         $.ajax({
            url: 'http://mydomain/zapsat_udalost_uziv_admin.php',
            data: {
                'procedura':procedura,
                'kontakt': info,
                'start': start,
                'LPG': lpg_bool,
                'typpaliva': typ_paliva,
                },
            type: "POST",
            success: function( data ) {
            alert('Done!');
            $('#calendar').fullCalendar( 'rerenderEvents' );

            }


           });        

});
});

#2 Calendar declaration

I have declared calendar into calendar div

var calendar = $('#calendar').fullCalendar({.....});
1

1 Answers

1
votes

Try this : addEventSource

    $('#calendar').fullCalendar('addEventSource', source)
    $('#calendar').fullCalendar('refetchEvents');