I've created a calendar with fullcalendar using the project of this site , but when I use PHP to get the bank events, they are not displayed in the schedule, but if I call a json it shows the event normally. In the PHP file I understand that a json is generated, but I do not know how to save it to use. If anyone knows what's wrong, I appreciate the help. Here is the code:
calendar.php
<script>
$(document).ready(function() {
//CARREGA CALENDÁRIO E EVENTOS DO BANCO
$('#calendario').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
//right: 'month,agendaWeek,agendaDay'
},
//defaultDate: '2016-01-12',
editable: true,
eventLimit: true,
events: 'eventos.php',
eventColor: '#dd6777'
});
});
</script>
<style>
#calendario{
position: relative;
width: 70%;
margin: 0px auto;
}
</style>
</head>
<body>
<div id='calendario'>
</div>
</body>
events.php
<?php
$conexao = mysqli_connect('', '', '', '');
$consulta = $conexao->query("SELECT event_id, title, start, end FROM eventos");
while ($linha = $consulta->fetch(PDO::FETCH_ASSOC)){
$vetor[]= "{id:{$linha['event_id']}, title: {$linha['title']}, start: {$linha['start']}, end:{$linha['end']}}";
}
//Passando vetor em forma de json
echo json_encode($vetor);