开发者

Full Calendar JSON Demo not working

I recently downloaded the Full Calendar program and was wondering what it requires to be in开发者_开发知识库stalled 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');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜