I am trying to use JQuery Full Calendar along with Spring MVC.

I have made a demo like that.

Target: I need to send the UPDATED calendar's data,after I enter my events, to the controller to handle it.

Issue: I've succeded to re-send the calendar I've inistialzed to the controller.
However,I can't send the updated calendar's data,after I enter my events, to the controller to handle it.

Freemarker:

<script type="text/javascript">
    var calendar;
    var calendarData;        

    function doAjax() {
        var test = JSON.stringify(calendarData, censor(calendarData));
          var x=$('#calendar').value;
        $.ajax(
        {
            url:"[@spring.url '/vacation/setVacation'/]",
            type: "POST",
            data :x ,
            dataType: "json",
            contentType: "application/json"
        });
    }

    $(document).ready(function() {
        var date = new Date();
        var d = date.getDate();
        var m = date.getMonth();
        var y = date.getFullYear();
        $.getJSON('[@spring.url '/vacation/getVacation'/]', function (data) {
            calendar = $('#calendar').fullCalendar({
                header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'month,agendaWeek,agendaDay'
                },
                selectable: true,
                selectHelper: true,
                select: function(start, end, allDay) {
                    var title = prompt('Event Title:');
                    if (title) {
                        calendar.fullCalendar('renderEvent',
                        {
                            title: title,
                            start: start,
                            end: end,
                            allDay: allDay
                        },
                                true // make the event "stick"
                                );
                    }
                    calendar.fullCalendar('unselect');
                },
                editable: true,
                events:data
            });
            calendarData = data;
        });
    });   

</script>

Recommended Answers

All 2 Replies

I've invested sometime before into JMonthCalendar.
Meantime I've been done most of the integration with the Full Calendar plugin and I was wondering if you can assist me into the part I've mentioned into my post regarding sending new events to the controller.
I believe it's easy but I'm not that good yet at JQuery .
Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.