我无法让我的活动显示在我的完整日历应用中。日历显示,当我手动输入它们显示的事件时。但是,当我尝试从JSON文件中提取时,它不起作用。这是我的代码:
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
events: {
url: '/events/json',
error: function()
{
alert("error");
},
success: function()
{
console.log("successfully loaded");
}
}
});
});
</script>
我收到的错误是:
jquery.self bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:10255 GET https://APP/events/json?start=2018-02-25&end=2018-04-08&_=1520803262179 404 (Not Found)
任何帮助都将不胜感激!!
编辑:
导航到https://APP/events.json时会显示以下内容:
[{"id":5,"title":"Example","description":"example","start_time":"2018-03-13T01:00:00.000Z","end_time":"2018-03-13T01:10:00.000Z","created_at":"2018-03-13T01:10:48.005Z","updated_at":"2018-03-13T01:10:48.005Z"}]
答案 0 :(得分:0)
将man exec
更改为url: '/events/json',
添加routes.rb
url: '/events.json',
在控制器events_controller.rb中添加操作
resources :events