如何解决将ajax的结果发送到我的fullCalendar事件
很抱歉,如果这是一个重复的问题,但是我在这里做了很多研究,但根据我使用的编程语言,我还没有找到答案。
我想将AJAX的结果传递给Fullcalendar的事件。我希望代码能被理解:
我只会放置此文件,因为另一个文件可以给我带来很好的效果。
calendar.js
$(document).ready(function () {
function getJSON(){
$.ajax({
url: 'ajax/calendario.ajax.php',dataType: "json",success: function (data) {
rs = JSON.stringify(data);
return rs;
console.log(rs);
}
});
}
$('#calendario').fullCalendar({
header:{
left: 'today,prev,next,Miboton',center: 'title',right: 'month,basicWeek,basicDay,agendaWeek,agendaDay'
},customButtons:{
Miboton:{
text: 'Boton 1',click:function(){
// alert('Accion del boton');
}
}
},dayClick:function (date,jsEvent,view) {
//alert('Valor seleccionado'+ date.format());
// alert('Vista seleccionado'+ view.name);
$(this).css('background-color','red');
$('#modalCalendario').modal();
},events: getJSON(),eventClick:function (calEvent,view) {
$('#tituloEvento').html(calEvent.title);
$('#descripcionEvento').html(calEvent.descripcion);
$('#modalCalendario').modal();
}
});
});
如您所见,在属性 events 中,我试图获取函数 getJSON()的结果,该函数从AJAX引入结果JSON。
正如您所看到的,当我在FullCalendar.js的属性 events 中调用 getJSON()时,会在控制台中得到此结果。
我觉得这很奇怪,因为我已复制了此JSON并粘贴到事件中,它给了我很好的结果,但是当我放入 getJSON()时却什么也没做。我想念的是什么?
今天休息愉快!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。