簡體   English   中英

完整的日歷通過周firstdate到控制器-下周移動jquery

[英]full calendar pass week firstdate to controller - moving next week jquery

我有完整的日歷。 我想將星期的開始日期傳遞給控制器​​,以便移至上一個/下一個星期。 我包括我的jQuery,如下所示:

var calendar = $('#calendar').fullCalendar(
   {
       header: {
           left: 'prev',
           center: 'title',
           right: 'next'
       },
       defaultView: 'basicWeek',

       events: function (start, end, callback) {
           $.get('events/get', function (result) {
               callback(result);
           });
 var cDate = new Date(); var Cyear = cDate.getFullYear(); year = Cyear;
           var Sun = $('#calendar').find(".fc-sun").text(); d1 = Sun; SelectDate = Sun + "/" + year; 
       }
   });

 $('#btnPrev').click(function () {
        $('#calendar').fullCalendar('prev');
        $.ajax({
            type: "POST",
            url: '/Timesheet/Index',
            data: SelectDate            
        });
    });
    $('#btnNext').click(function () {
        $('#calendar').fullCalendar('next');
        //$.ajax({
        //    type: "POST",
        //    url: "/Timesheet/Index?SelectDate=" + SelectDate,
        //    success: function (data) {

        //    },
        //    error: function () {

        //    }
        //});
    });

如何將其傳遞給控制器​​?

我可以使用以下代碼在日歷中移動下一個/上個星期:

$('.fc-prev-button').click(function () {
        startDate = $('#calendar').fullCalendar('getDate').startOf('week');       
        window.location.href = "/TimesheetModels/EmpTimesheet?selectDate=" + convertDate(startDate);
    });

    $('.fc-next-button').click(function () {;
        startDate = $('#calendar').fullCalendar('getDate').startOf('week');        
        window.location.href = "/TimesheetModels/EmpTimesheet?selectDate=" + convertDate(startDate);
    });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM