php – Send id by URL for full calendar

Question:

I use Full Calendar to display a calendar on my system, but I'm not able to send an id through the url of the file that json assembles with the dates, and I need this to filter the events that are linked only to this id . Below is my code:

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 anyone knows how I can do it, I appreciate it!

Answer:

Some details have been adjusted. Below is the resolution:

events.php

<?php
$id = $_GET['id'];
$consulta = $conexao->query("SELECT id, title, start, ADDDATE(end, INTERVAL 1 DAY) as end FROM registros where pan_id = '$id'");
    while ($linha = $consulta->fetch(PDO::FETCH_ASSOC)) { 
        $vetor[] = $linha;   
    }
echo json_encode($vetor);

agenda.php

<?php
  $id = $_GET['id'];
  $result = mysqli_query($conexao, "SELECT * FROM registros WHERE id = '$id'");
    while($exibe = mysqli_fetch_array($result)){?>
      <input type="hidden" name="id" id="id" value="<?php echo $exibe['id']?>"/>
    <?php }?>
        <script>
        var id = document.getElementById('id').value;
                    $(document).ready(function() {  

                    $('#calendario').fullCalendar({
                        header: {
                            left: 'today, prev,next',
                            center: 'title',
                            right: 'month,agendaWeek,agendaDay'
                        },
                        editable: true,
                        eventLimit: true, 
                        events: 'eventos.php?id='+id,          
                        eventColor: '#0277BD'
                    }); 
            }); 

            </script> 
Scroll to Top
AllEscort