如何让FullCalendar显示来自我的JSON供稿的信息? [英] How do I get FullCalendar to display information from my JSON feed?

查看:118
本文介绍了如何让FullCalendar显示来自我的JSON供稿的信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用FullCalendar设置应用程序( http://arshaw.com/fullcalendar/ )这将允许用户查看客户端调度信息以及通过管理界面安排客户端。

I'm setting up an app using FullCalendar (http://arshaw.com/fullcalendar/) that will allow the user to see client scheduling information as well as schedule clients through a management interface.

我想使用MySQL数据库来填充数组,然后通过该数组以HTML页面上FullCalendar的JSON提要形式提供。理想情况下,客户端信息将显示在HTML页面上。然而,即使我的JSON feed正在传递,我的FullCalendar上也没有事件发生。

I want to use a MySQL database to populate an array, and then pass that array in the form of a JSON feed to FullCalendar on an HTML page. Ideally, then, the client information would show up on the HTML page. However, even though my JSON feed is being passed, there are no events on my FullCalendar.

传递示例JSON提要:

Example JSON feed being passed:

[{"title":"Watson","start":"1333976400","end":"1333980000","allDay":false}]

我对这些语言相当陌生,如果这个错误变得很简单,我不会感到惊讶。

I'm fairly new to these languages and I would not be surprised if this mistake turn out to be simple.

帮助或了解这些事件。当我手动将数组提供给FullCalendar时,它确实显示了这些事件,但到目前为止,我的JSON提要没有显示任何信息。

I would deeply appreciate any help or insight on having these events show up. When I manually feed an array into FullCalendar, it does show the events, but so far my JSON feed has resulted in no information being displayed.

谢谢

仅供参考:
HTML:

For reference: HTML:

        $(document).ready(function() {      
        $('#calendar').fullCalendar({
            events: '/json-events.php'
        });     
});

PHP:

PHP:

        while ($record = mysql_fetch_array($result)) {
        $event_array[] = array(
            'id' => $record['id'],
            'title' => $record['title'],
            'start' => $record['start_date'],
            'end' => $record['end_date'],
            'allDay' => false
        );
    }

echo json_encode($event_array);


推荐答案

对于那些追随我的搜索者,是我的PHP文件有HTML头部和身体标签。我是一个PHP noob,所以我不知道这会导致它不工作。为了让FullCalendar显示JSON供稿,它必须只有PHP代码,不能有HTML。 JSONLint.com对此非常有价值。

So the problem, for those searchers that come after me, was that my PHP file had HTML head and body tags. I'm a PHP noob and so I didn't know that would cause it not to work. In order for FullCalendar to display the JSON feed, it must ONLY have PHP code, no HTML. JSONLint.com was invaluable in figuring that out.

这篇关于如何让FullCalendar显示来自我的JSON供稿的信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆