从 myfeeds.php 返回什么(服务器端)

发布于 2025-01-01 13:56:12 字数 917 浏览 1 评论 0原文

我从服务器端页面 (getEvents.cfm) 返回以下字符串。我在 ColdFusion 工作。

[
{
    title: 'Event1',
    start: '2012-02-02',
    end: '2012-02-02',
    allDay: 'no'
},
{
    title: 'Event2',
    start: '2012-02-03',
    end: '2012-02-03',
    allDay: 'no'
}
]

但我在页面加载时收到错误“获取事件时出错!”

这是我用来获取事件的代码:

eventSources: [

            // your event source
            {
                url: '../getevents.cfm',
                type: 'POST',
                data: {
                    custom_param1: 'something',
                    custom_param2: 'somethingelse'
                },
                error: function() {
                    alert('there was an error while fetching events!');
                },
                color: 'yellow',   // a non-ajax option
                textColor: 'black' // a non-ajax option
            }

            // any other sources...

]

I am returning the following string from my server side page (getEvents.cfm). I am working in ColdFusion.

[
{
    title: 'Event1',
    start: '2012-02-02',
    end: '2012-02-02',
    allDay: 'no'
},
{
    title: 'Event2',
    start: '2012-02-03',
    end: '2012-02-03',
    allDay: 'no'
}
]

But I get an error on page load 'there was an error while fetching events!'

Here is the code that I am using to fetch events:

eventSources: [

            // your event source
            {
                url: '../getevents.cfm',
                type: 'POST',
                data: {
                    custom_param1: 'something',
                    custom_param2: 'somethingelse'
                },
                error: function() {
                    alert('there was an error while fetching events!');
                },
                color: 'yellow',   // a non-ajax option
                textColor: 'black' // a non-ajax option
            }

            // any other sources...

]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

等风来 2025-01-08 13:56:12

首先,allDay 应该是 true/false 而不是 no/yes。其次,返回字符串应如下所示:

 [{
    "title": 'Event2',
    "start": '2012-02-03',
    "end": '2012-02-03',
    "allDay": 'false'
}]

First of all allDay should be true/false not no/yes. Second, the return string should look like this:

 [{
    "title": 'Event2',
    "start": '2012-02-03',
    "end": '2012-02-03',
    "allDay": 'false'
}]
段念尘 2025-01-08 13:56:12
$.getJSON('path_to_your_json_file',function(data){
   $.each(data,function(index,entry){
      //assuming we already have a <div> created and get the id
         //show the JSON data
      $('#div_id_created_earlier').append('
         'Title: ' + entry.title + '<br \/>' + 
         'Start: ' + entry.start + '<br \/>' +
         'End: ' + entry.end + '<br \/>' +
         'All day: ' + entry.allDay + '<br \/><br \/>' +
      ');
   });
});
$.getJSON('path_to_your_json_file',function(data){
   $.each(data,function(index,entry){
      //assuming we already have a <div> created and get the id
         //show the JSON data
      $('#div_id_created_earlier').append('
         'Title: ' + entry.title + '<br \/>' + 
         'Start: ' + entry.start + '<br \/>' +
         'End: ' + entry.end + '<br \/>' +
         'All day: ' + entry.allDay + '<br \/><br \/>' +
      ');
   });
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文