首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Jquery Frontier日历

Jquery Frontier日历
EN

Stack Overflow用户
提问于 2011-08-24 14:24:51
回答 2查看 1.9K关注 0票数 0

我使用的是Frontier Jquery Calendar。此日历用于创建事件/议程。现在我想当用户创建事件从日历,然后这些事件存储在数据库中。我不知道该怎么做。有谁能给我指路吗?谢谢,

EN

回答 2

Stack Overflow用户

发布于 2011-08-24 14:52:01

我没有从日历的屏幕截图或文档中看到任何输入函数,所以我认为您需要:

  1. 为用户提供了一种输入新事件details.
  2. Capture结果并将其存储到数据库中的方法。

因为问题很简单,所以我会给你一个简单的答案:http://teamtutorials.com/web-development-tutorials/php-tutorials/inserting-data-into-a-mysql-database-using-php

如果您特别想使用漂亮的ajax、漂亮的json和漂亮的css与漂亮的日历进行良好的集成,那么您必须将其分解为更具体的问题,因为您可以编写几本关于这些主题的书籍。

票数 0
EN

Stack Overflow用户

发布于 2015-12-30 19:49:12

如果只想使用php插入数据,可以在其add event表单上使用表单,并使用post方法将数据发送到php文件,然后在php文件中,可以使用php轻松地将post数据插入到数据库中。

但是,如果您想在甚至不重新加载页面的情况下添加数据,您可以在jquery-frontier-cal-1.3.2.js(或您使用的任何版本的插件文件)的this.addAgendaItem函数中使用ajax调用,如下所示:

代码语言:javascript
复制
this.addAgendaItem = function(calId,title,startDate,endDate,allDay,data,displayProp){
        if(calId != null && title != null && startDate != null && endDate != null && allDay != null){
            // make sure start date comes before end date
            if(DateUtil.secondsDifferenceDirection(startDate,endDate) < 0){
                alert("Sorry, you can't create an event that ends before it starts");
                return;
            }
           $.ajax({
                type: 'POST',
                url: "/*your php file path*/ ",
                async: false,
                data: { /*Send data to using ajax*/ },
                success: function (data) {
                 //handle on success
                },
                error: function (xhr, textStatus, errorThrown) {
                 //handle on error
               }

            });
            calId = stripNumberSign(calId);
            var hashData = new Hashtable();
            if(data != null){
                for(var key in data){
                    hashData.put(key,data[key]);
                }
            }
            var agi = new CalendarAgendaItem(title,startDate,endDate,allDay,hashData);
            if(displayProp != null){
                if(displayProp.backgroundColor != null){
                    agi.setBackgroundColor(displayProp.backgroundColor);
                }
                if(displayProp.foregroundColor != null){
                    agi.setForegroundColor(displayProp.foregroundColor);
                }
            }
            var calObj = myCalendars.get(calId);
            calObj.addAgendaItem(agi);      
        }
    };

您可以随心所欲地处理此ajax调用。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7171274

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档