Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to have fullCalendar reflect changes made to a database via AJAX. The problem is that it won't update the calendar on screen after a successful AJAX call.

$.ajax({
    type: "POST",
    url: "eventEditXHR.php",
    data: {
       //the data
    },
    success: function(text) {
      $("#calendar").fullCalendar("refetchEvents");
    }....

I'm I using the wrong method? What would be the best way to accomplish this without having to reload the whole page? Thanks for any input!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
614 views
Welcome To Ask or Share your Answers For Others

1 Answer

There are several ways. Some less elegant.

1. If you are using FullCalendar to grab json events:

$('#calendar').fullCalendar({ events: "json-events.php",    });

Just do:

$('#calendar').fullCalendar( 'refetchEvents' );

If you want outside method to fetch events you could do. Not elegant but will work

$('#calendar').fullCalendar( 'removeEventSource', source )
$('#calendar').fullCalendar( 'addEventSource', source )

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...