【发布时间】:2015-09-10 11:41:02
【问题描述】:
我正在使用FullCalendar,我想在此日历中显示 JSON 数据,但在显示通过 AJAX 调用以 JSON 格式接收的数据时出现错误 - 数据未显示。如何在 JavaScript 中显示数据?
我已包含文件:
fullcalendar.css、fullcalendar.print.css、moment.min.js、jquery.min.js、fullcalendar.min.js
她是我的 HTML:
<div class="row">
<div id='calendar'></div>
<div class="clear"></div>
</div>
这是我的 JS:
$(function(){
$("#get_schedule").click(function(){
var clas=$("#selectclass").val();
var section=$("#selectsection").val();
$.ajax({
url:'events7.php',
type:'POST',
data:{class_name:clas,class_id:section},
success:function(resp){
if(resp!=''){
alert(resp);
$("#calendar").fullcalendar({
eventSources:
{
url: 'events7.php', // for lectures
color: '#FF4D4D',
textColor: 'black'
},
})
}else{
alert(1);
}
}
});
})
})
【问题讨论】:
-
欢迎来到 Stack Overflow!是否显示任何错误?或者控制台中有什么东西?
-
@naXa 谢谢!那么没有这样的错误。我只能在JS的alert中获取数据。
标签: javascript php jquery json ajax