Hassan Sardar
Hassan Sardar

Reputation: 4523

How to Reload JSON data in Fullcalendar?

I am using Fullcalendar.

In my case I am adding Custom Events, Like when user clicks on specific date, he can add his event, when he is done with insertion, the custom event he just added show automatically appear on calendar, means the fresh JSON Data should reload and appear.

Here is my code:

events      : "ajax/response.php",//Fetching JSON From PHP File//

function insertEventSchedule()
{

    var title           = $('#titl').val();
    var fromDate        = $('#fromDate').val();
    var toDate          = $('#toDate').val();

        $.ajax({
                        type: "POST",
                        url : "ajax/insert_schedule_event.php",
                        data: "title="+title+"&fromDate="+fromDate+"&toDate="+toDate+"&timeStamp="+$.now(), 
                        cache: false,
                        beforeSend:  function() 
                            {
                                $('.submit_data').html('<img src="include/content/loaders/ajax-loader.gif" width="20">');
                            },
                        success: function(html)
                            {
                                $('#myPopup').dialog('close');  
                            }
                     });
    }
}

Upvotes: 0

Views: 292

Answers (1)

storm_buster
storm_buster

Reputation: 7568

You have to build an event Object and render that event using the renderEvent method before or after closing your dialog

UPDATE

var newEvent = new Object();

newEvent.title = "some text";
newEvent.start = new Date();
newEvent.allDay = false;
// ...
$('#calendar').fullCalendar( 'renderEvent', newEvent );

The complete list of event attribute are here

Upvotes: 3

Related Questions