Fullcalendar事件下降和AJAX [英] Fullcalendar Event drop and ajax

查看:99
本文介绍了Fullcalendar事件下降和AJAX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在与伟大的jQuery插件 - Fullcalendar但我遇到的一个问题。我用的是eventDrop听众,我想使用Ajax事件信息发送到我的服务器端。

I'm currently working with the great Jquery plugin - Fullcalendar but I'm encountering a problem. I use the eventDrop listener and I want to send the event information using Ajax to my server side.

我的code是如下:

eventDrop: function (event, dayDelta) {

                $.ajax({
                    url: ("/PSAdmin/RFCalendar/DragEvent"),
                    data: ({
                        type: event.className,
                        delta: dayDelta,
                        newDate: event.start,
                        newTitle: event.title
                    }),
                    type: "POST",
                    success: function (data) {
                        $('#calendar').empty();
                        loadCalendar();
                    },
                    error: function (xhr, status, error) {
                        alert("fail");
                    }
                });
}

我的问题是,当我尝试发送包含到事件对象的任何变量,这是行不通的。例如只发送dayDelta到服务器端的作品,但没有event.something的一样。

My problem is that as soon as I try to send any variable contained into the event object, it doesn't work. For example sending only dayDelta to the server side works, but none of the event.something does.

如果有人无意中发现了这个问题之前,或者如果您有任何想法可能会导致问题,请让我知道。

If anyone stumbled on this problem before or if you have any idea what could cause the problem, please let me know.

推荐答案

所以,不幸的是,我无法弄清楚,为什么AJAX查询不能正常工作,我不得不做我不想做的最初。

So unfortunately, I couldn't figure out why the ajax query wasn't working properly and I had to do what i didn't want to do originally.

if (event.className == "holiday") {
                    var className = "holiday";
                }

                //build date
                var date = event.start.getMonth()+1 + "/" + event.start.getDate() + "/" + event.start.getFullYear();
                alert(date);

                $.ajax({
                    url: ("/PSAdmin/RFCalendar/DragEvent/"),
                    data: ({
                        className: className,
                        delta: dayDelta,
                        newDate: date,
                        newTitle: event.title
                    }),
                    type: "POST",
                    success: function (data) {
                        $('#calendar').empty();
                        loadCalendar();
                    },
                    error: function (xhr, status, error) {
                        alert("fail");
                    }
                });

这是丑陋和费时,但至少它的工作原理。我有其他优先项目上工作,但如果你有任何关于这个问题的线索,请让我知道。

It's ugly and time consuming but at least it works. I have other priorities to work on but if you have any clue about this problem, please let me know.

谢谢, 格雷格

这篇关于Fullcalendar事件下降和AJAX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆