FullCalender JSON提要无法正常工作 [英] FullCalender JSON Feed not working
本文介绍了FullCalender JSON提要无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么我的日历把来自JSON提要将数据放置到我的网页上?
<脚本类型=文/ JavaScript的'>
$(文件)。就绪(函数(){
VAR日期=新的日期();
变种D = date.getDate();
变种米= date.getMonth();
变种Y = date.getFullYear();
VAR日历= $('#日历)。fullCalendar({
事件:myfeed.php,
标题:{
左:'preV,接下来的今天,
中心:'标题',
右:一个月,agendaWeek,agendaDay
},
可选:真正的,
selectHelper:真正的,
eventSources:
//你的事件源
{
网址:/myfeed.php',//使用`url`财产
颜色:红色,//一种选择!
文字颜色:'黑'//一个选择!
}
//任何其他来源...
]
eventClick:功能(calEvent,jsEvent,视图){
如果(!确认(你确定要删除吗?)){
}
其他
{
//删除日历和发布信息页面
$。员额(mybook.php,{IDNumber中:calEvent.id,删除:1});
$('#日历)fullCalendar('REMOVEEVENTS',[calEvent.id])。
}
}
});
});
< / SCRIPT>
JSON提要PHP code
< PHP $ ARR =阵列('身份证'=>'1','标题'=>'苹果','开始'=>'1372530615' ,结束=>'1372537615','allDay'=>假);
回声json_en code($ ARR);
?>
查尔斯卷筒纸调试器显示该脚本评估右页,它有一个响应。但是,我的日历不执行任何操作。 :(我想这可能是因为我使用SSL,但我已经尝试了两种方式。
我减少code到
<脚本类型=文/ JavaScript的SRC ='的jQuery 1.9.1.min.js'>< / SCRIPT>
<脚本类型=文/ JavaScript的SRC =fullcalendar.js'>< / SCRIPT>
<脚本类型=文/ JavaScript的'>
$(文件)。就绪(函数(){
VAR日历= $('#日历)。fullCalendar({
事件:myfeed.php
});
});
< / SCRIPT>
JSON提要输出
{ID:1,称号:苹果,allDay:假的,开始:1372507615,底:1372537615 }
解决方案
只好把[]在我的JSON输出。
Why doesn't my calender put the data from the JSON feed onto my webpage?
<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({
events: 'myfeed.php',
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
selectable: true,
selectHelper: true,
eventSources: [
// your event source
{
url: '/myfeed.php', // use the `url` property
color: 'red', // an option!
textColor: 'black' // an option!
}
// any other sources...
],
eventClick: function(calEvent, jsEvent, view) {
if (!confirm("Are you sure you want to delete this?")) {
}
else
{
// remove calender, and post the info to page
$.post("mybook.php", { idnumber: calEvent.id, remove: '1' } );
$('#calendar').fullCalendar('removeEvents', [calEvent.id]);
}
}
});
});
</script>
JSON Feed PHP Code
<?php $arr = array('id' => '1', 'title' => 'Apples', 'start' => '1372530615', 'end' => '1372537615', 'allDay' => false);
echo json_encode($arr);
?>
Charles web debugger shows that the script is assessing the right page, and it has a response. But, my calender does nothing. :( I thought it might be because I was using SSL, but I have tried both ways.
Reduced my code to
<script type='text/javascript' src='jquery-1.9.1.min.js'></script>
<script type='text/javascript' src='fullcalendar.js'></script>
<script type='text/javascript'>
$(document).ready(function() {
var calendar = $('#calendar').fullCalendar({
events: 'myfeed.php'
});
});
</script>
JSON Feed Output
{"id":"1","title":"Apples","allDay":false,"start":"1372507615","end":"1372537615"}
解决方案
Had to put [ ] around my JSON Output.
这篇关于FullCalender JSON提要无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文