大神请进,请教fullcalendar日历控件$.post保存数据库问题

zt061013 2013-02-18 08:55:57

viewDisplay: function (view) {
var viewStart = $.fullCalendar.formatDate(view.start, "yyyy-MM-dd");
var viewEnd = $.fullCalendar.formatDate(view.end, "yyyy-MM-dd HH:mm:ss");
//alert(viewStart+viewName);
$("#calendar").fullCalendar('removeEvents');
$.getJSON('schedule/containEvents', { start: viewStart, end: viewEnd }, function (data) {
for (var i = 0; i < data.length; i++) {
var obj = new Object();
obj.id = data[i].id;
obj.title = data[i].title;
obj.description = data[i].description;
obj.color = data[i].color;
obj.remindertime = $.fullCalendar.parseDate(data[i].remindertime);
obj.messagenotice = data[i].messagenotice;
obj.description = data[i].description;
obj.start = $.fullCalendar.parseDate(data[i].start);
obj.end = $.fullCalendar.parseDate(data[i].end);
$("#calendar").fullCalendar('renderEvent', obj, true); //把从后台取出的数据进行封装以后在页面上以fullCalendar的方式进行显示
}
});
},
selectable: true,
selectHelper: true,
select: function (start, end, allDay) {
$("#dvInput").dialog({
buttons: [{
text: "保存", click: function () {
var leixing = $('#leixing').val(), neirong = $('#neirong').val()
, title = '类型:' + leixing + '<br/>内容:' + neirong;
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: allDay
},
true // make the event "stick"
); //把刚输入的日程计划在页面上进行显示

//alert($.fullCalendar.formatDate(start,'yyyy-MM-dd HH:mm:ss'));
$.post("schedule/add", {//把刚输入的日程计划信息传到后台,保存到数据库
title: title,
start: ($.fullCalendar.formatDate(start, 'yyyy-MM-dd h:mm:ss')),
end: ($.fullCalendar.formatDate(end, 'yyyy-MM-dd h:mm:ss')),
allDay: allDay
});

calendar.fullCalendar('unselect');
$(this).dialog("关闭");
}
}]
});
}
});

});
//<div id="dvInput" title ="请输入内容" style ="display :none">
类型:<input type ="text" id="leixing" /><br />
内容:<input type ="text" id ="neirong" /><br />
</div>
<div id='calendar'> </div>//


数据库是SQL2005,库是RiCheng,表名RCguanli,

有5个字段,ID主键,开始时间 结束时间 (datetime),类型 内容(varchar)
...全文
163 5 1 打赏 收藏 举报
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
still_melody 2013-02-18
引用 3 楼 zt061013 的回复:
引用 2 楼 still_melody 的回复:JavaScript code?123456$.post("schedule/add", {//把刚输入的日程计划信息传到后台,保存到数库 title: title, start: ($.fullCalendar.formatDate(start, 'yyyy-MM-dd hh:mm:ss')), ……
我不知道你用的是什么框架。 你能找到add吗? 你就这一个页面吗?照着其他页面的写。或者你把其他页面保存数据的写法贴出来
  • 打赏
  • 举报
回复
zt061013 2013-02-18
引用 2 楼 still_melody 的回复:
JavaScript code?123456$.post("schedule/add", {//把刚输入的日程计划信息传到后台,保存到数库 title: title, start: ($.fullCalendar.formatDate(start, 'yyyy-MM-dd hh:mm:ss')), end: ($.fullCale……
大神,怎么写?菜鸟求教
  • 打赏
  • 举报
回复
still_melody 2013-02-18

$.post("schedule/add", {
//把刚输入的日程计划信息传到后台,保存到数库        
title: title,       
start: ($.fullCalendar.formatDate(start, 'yyyy-MM-dd hh:mm:ss')),         
end: ($.fullCalendar.formatDate(end, 'yyyy-MM-dd h:mm:ss')),        
allDay: allDay}); 
把数据发送到了schedule/add,在add里接收数据写sql保存的数据库
  • 打赏
  • 举报
回复
论文MVP网 2013-02-18
首先 这个和JQ是没关系的, 你需要的是 在查看插入操作的时候出现的 参数问题
  • 打赏
  • 举报
回复
zt061013 2013-02-18
引用 4 楼 still_melody 的回复:
引用 3 楼 zt061013 的回复: 引用 2 楼 still_melody 的回复:JavaScript code?123456$.post("schedule/add", {//把刚输入的日程计划信息传到后台,保存到数库 title: title, start: ($.fullCalendar.formatDate(start, 'yyyy-MM-dd hh:m……

    <script type='text/javascript'>

        $(document).ready(function () {
            var date = new Date();
            var d = date.getDate();
            var m = date.getMonth();
            var y = date.getFullYear();

            var calendar = $('#calendar').fullCalendar({
                header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'month,agendaWeek,agendaDay'
                },
                monthNames: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
                monthNamesShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
                dayNames: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
                dayNamesShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
                today: ["今天"],
                firstDay: 1,
                buttonText: {
                    today: '今天',
                    month: '月',
                    week: '周',
                    day: '日',
                    prev: '上一个月',
                    next: '下一个月'
                },

                allDaySlot: true,
                selectable: true,
                selectHelper: true,
                aspectRatio: 2.7,
                editable: false,
                allDayDefault: true,
                editable: true,

                events: [
                       {
                           title: 'All Day Event',
                           start: new Date(y, m, 1)
                       },
                       {
                           title: 'Long Event',
                           start: new Date(y, m, d - 5),
                           end: new Date(y, m, d - 2)
                       },
                       {
                           id: 999,
                           title: 'Repeating Event',
                           start: new Date(y, m, d - 3, 16, 0),
                           allDay: false
                       },
                       {
                           id: 999,
                           title: 'Repeating Event',
                           start: new Date(y, m, d + 4, 16, 0),
                           allDay: false
                       },
                       {
                           title: 'Meeting',
                           start: new Date(y, m, d, 10, 30),
                           allDay: false
                       },
                       {
                           title: 'Lunch',
                           start: new Date(y, m, d, 12, 0),
                           end: new Date(y, m, d, 14, 0),
                           allDay: false
                       },
                       {
                           title: 'Birthday Party',
                           start: new Date(y, m, d + 1, 19, 0),
                           end: new Date(y, m, d + 1, 22, 30),
                           allDay: false
                       },
                       {
                           title: 'Click for Google',
                           start: new Date(y, m, 28),
                           end: new Date(y, m, 29),
                           url: 'http://google.com/'
                       }
                ],
                viewDisplay: function (view) {
                    var viewStart = $.fullCalendar.formatDate(view.start, "yyyy-MM-dd");
                    var viewEnd = $.fullCalendar.formatDate(view.end, "yyyy-MM-dd HH:mm:ss");
                    //alert(viewStart+viewName); 
                    $("#calendar").fullCalendar('removeEvents');
                    $.getJSON('schedule/containEvents', { start: viewStart, end: viewEnd }, function (data) {
                            for(var i=0;i<data.length;i++) {  
                                var obj = new Object();  
                                obj.id = data[i].id;  
                                obj.title = data[i].title;                 
                                obj.description = data[i].description;          
                                obj.color = data[i].color;
                                obj.remindertime = $.fullCalendar.parseDate(data[i].remindertime);
                                obj.messagenotice = data[i].messagenotice;
                                obj.description = data[i].description;
                                obj.start = $.fullCalendar.parseDate(data[i].start);                 
                                obj.end = $.fullCalendar.parseDate(data[i].end); 
                                $("#calendar").fullCalendar('renderEvent',obj,true); //把从后台取出的数据进行封装以后在页面上以fullCalendar的方式进行显示 
                        }
                    });
                },
                selectable: true,
                selectHelper: true,
                select: function (start, end, allDay) {
                    $("#dvInput").dialog({
                        buttons: [{
                            text: "保存", click: function () {
                                var leixing = $('#leixing').val(), neirong = $('#neirong').val()
                                , title = '类型:' + leixing + '<br/>内容:' + neirong;
                                calendar.fullCalendar('renderEvent',
                                    {
                                        title: title,
                                        start: start,
                                        end: end,
                                        allDay: allDay
                                    },
                                    true // make the event "stick" 
                                ); //把刚输入的日程计划在页面上进行显示 

                                //alert($.fullCalendar.formatDate(start,'yyyy-MM-dd HH:mm:ss')); 
                                $.post("schedule/add", {//把刚输入的日程计划信息传到后台,保存到数据库 
                                    title: title,
                                    start: ($.fullCalendar.formatDate(start, 'yyyy-MM-dd h:mm:ss')),
                                    end: ($.fullCalendar.formatDate(end, 'yyyy-MM-dd h:mm:ss')),
                                    allDay: allDay
                                });

                                calendar.fullCalendar('unselect');
                                $(this).dialog("关闭");
                            }
                        }]
                    });
                }
            });

        });
    </script> 

<style type='text/css'>

	body {
		margin-top: 40px;
		text-align: center;
		font-size: 14px;
		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
		}
		
	#wrap {
		width: 1100px;
		margin: 0 auto;
		}
		
	#external-events {
		float: left;
		width: 150px;
		padding: 0 10px;
		border: 1px solid #ccc;
		background: #eee;
		text-align: left;
		}
		
	#external-events h4 {
		font-size: 16px;
		margin-top: 0;
		padding-top: 1em;
		}
		
	.external-event { /* try to mimick the look of a real event */
		margin: 10px 0;
		padding: 2px 4px;
		background: #3366CC;
		color: #fff;
		font-size: .85em;
		cursor: pointer;
		}
		
	#external-events p {
		margin: 1.5em 0;
		font-size: 11px;
		color: #666;
		}
		
	#external-events p input {
		margin: 0;
		vertical-align: middle;
		}

	#calendar {
		
		width: 100%;
        
		}

</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
     <div class="toolbar">
        <div class="toolbarLeft">
        </div>
        <div class="toolbarContent">
           
             <asp:LinkButton ID="lbAdd" CssClass="icon_add firstebox" runat="server"    isiframe="true" modal="true" xheight="400" xwidth="500"
               href="WebForm1.aspx">新增</asp:LinkButton>
             <asp:LinkButton ID="lbSearch" CssClass="icon_search firstebox" runat="server"  isiframe="true" modal="true" xheight="300" xwidth="400"
                 >查询</asp:LinkButton>
             <asp:LinkButton ID="LinkButton1" CssClass="icon_help firstebox" runat="server"  isiframe="true" modal="true" xheight="300" xwidth="400"
                 >统计</asp:LinkButton>
            
        </div>
        <div class="toolbarRight">
        </div>
        <div class="clear">
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <div id="dvInput" title ="请输入内容" style ="display :none">
        类型:<input type ="text" id="leixing" /><br />
        内容:<input type ="text" id ="neirong" /><br />
        </div>
<div id='calendar'> </div>
</asp:Content>
这是我的全部代码,现在就是不知道怎么把text里面的内容保存到数据库中....
  • 打赏
  • 举报
回复
相关推荐
发帖
.NET社区
加入

5.9w+

社区成员

.NET技术交流专区
申请成为版主
帖子事件
创建了帖子
2013-02-18 08:55
社区公告
暂无公告