I use Full Calendar to display a calendar on my system, but I am not able to send a id
through the url of the file that json mounts with the dates, and I need to filter the events that are only bound to this id
. Here is my code below:
Calendar page:
<script>
var id = '<?php echo '<a href="eventos?id=' . $id . '">'?>'
$(document).ready(function() {
//CARREGA CALENDÁRIO E EVENTOS DO BANCO
$('#calendario').fullCalendar({
header: {
left: 'prev,next',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
eventLimit: true,
events: 'eventos.php',
eventColor: '#0277BD'
});
});
</script>
<section class="panel">
<header class="panelheading" id="locado">
Agenda
</header>
<div class="panel-body" id="panel">
<div class="panel-body table-responsive">
<div class="page">
<div id='calendario'>
</div>
</div>
</div>
</div>
</section>
events.php
$id = $_GET['id'];
$consulta = $conexao->query("SELECT id, title, start, ADDDATE(end, INTERVAL 1 DAY) as end FROM calendario where id = '$id'");
while ($linha = $consulta->fetch(PDO::FETCH_ASSOC)) {
$vetor[] = $linha;
}
echo json_encode($vetor);
If someone knows how I can do it, thank you!