当前位置: 动力学知识库 > 问答 > 编程问答 >

fullcalendar - Full Calendar JSON Demo not working

问题描述:

I recently downloaded the Full Calendar program and was wondering what it requires to be installed on the server to work with JSON feeds. I tried running the json demo provided with the download but it does not fetch any events from the provided php file.

Thanks for any help

网友答案:

I got the same problem, but solving is quite easly, just check that json.html doesn't have headers set up correctly (in fact it doesn't have links to CSS nor JQuery or javascript files), just check that. A copy of my json.html is:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel='stylesheet' type='text/css' href='../public/js/fullcalendar/fullcalendar.css' />
<link rel='stylesheet' type='text/css' href='../public/js/fullcalendar/fullcalendar.print.css' media='print' />
<script type='text/javascript' src='../public/js/jquery/jquery-1.5.2.min.js'></script>
<script type='text/javascript' src='../public/js/jquery/jquery-ui-1.8.11.custom.min.js'></script>
<script type='text/javascript' src='../public/js/fullcalendar/fullcalendar.min.js'></script>
<script type='text/javascript'>

    $(document).ready(function() {

        $('#calendar').fullCalendar({

            editable: true,

            events: "json-events.php",

            eventDrop: function(event, delta) {
                alert(event.title + ' was moved ' + delta + ' days\n' +
                    '(should probably update your database)');
            },

            loading: function(bool) {
                if (bool) $('#loading').show();
                else $('#loading').hide();
            }

        });

    });

</script>
<style type='text/css'>

    body {
        margin-top: 40px;
        text-align: center;
        font-size: 14px;
        font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
        }

    #loading {
        position: absolute;
        top: 5px;
        right: 5px;
        }

    #calendar {
        width: 900px;
        margin: 0 auto;
        }

</style>
</head>
<body>
<div id='loading' style='display:none'>loading...</div>
<div id='calendar'></div>
<p>json-events.php needs to be running in the same directory.</p>
</body>
</html>
网友答案:

it calls a PHP file (json-events.php) so you need be running the example from a webserver that has php installed

网友答案:

It worked for me once I set the timezone correct.

Add this to the json-events.php file:

date_default_timezone_set('America/Los_Angeles');
分享给朋友:
您可能感兴趣的文章:
随机阅读: