JavaScript语法错误(Calendar.js)

时间:2017-01-20 14:18:48

标签: javascript asp.net-mvc view syntax

Updated Error Image我试图将数据库数据从控制器传递给calendar.js的java脚本定义。但是当我试图这样做时,我得到了这些错误。任何人都可以帮助我摆脱语法错误。

enter image description here

$(window).load(function() {
    var date = new Date(),
        d = date.getDate(),
        m = date.getMonth(),
        y = date.getFullYear(),
        started,
        categoryClass;

    var calendar = $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        selectable: true,
        selectHelper: true,
        select: function(start, end, allDay) {
            $('#fc_create').click();

            started = start;
            ended = end;

            $(".antosubmit").on("click", function() {
                var title = $("#title").val();
                if (end) {
                    ended = end;
                }

                categoryClass = $("#event_type").val();

                if (title) {
                    calendar.fullCalendar('renderEvent', {
                            title: title,
                            start: started,
                            end: end,
                            allDay: allDay
                        },
                        true // make the event "stick"
                    );
                }

                $('#title').val('');

                calendar.fullCalendar('unselect');

                $('.antoclose').click();

                return false;
            });
        },

        eventClick: function(calEvent, jsEvent, view) {
            $('#fc_edit').click();
            $('#title2').val(calEvent.title);

            categoryClass = $("#event_type").val();

            $(".antosubmit2").on("click", function() {
                calEvent.title = $("#title2").val();

                calendar.fullCalendar('updateEvent', calEvent);
                $('.antoclose2').click();
            });

            calendar.fullCalendar('unselect');
        },

        editable: true,

        var events = [];

        @foreach(var place in Model) {

            < text >

                var takvim = {
                    title: '@place.Ekip_id',
                    start: new Date(y, m, 28),
                    end: new Date(y, m, 29),
                };

            events.push(takvim);

            < /text>
        };
    });
});

0 个答案:

没有答案