I have a evocalendar that i want to use php to make the calendar dynamic
<script>
    $(document).ready(function() {
    $('#calendar').evoCalendar({
        
        calendarEvents: [
        {
        id: '1', // Event's ID (required)
        name: "Finding The Person Called Me", // Event name (required)
        date: "January/1/2020", // Event date (required)
        description:"test event of finding the person called me",
        type: "Public Meeting", // Event type (required)
        everyYear: false // Same event every year (optional)
      }
  ]
  });
When it like this the jquery works, javascript works.But when i add php like the code below, then works. What is the cause?
    <?php
       <script>
        $(document).ready(function() {
        $('#calendar').evoCalendar({
    
            
            calendarEvents: [
    
            {
            id: '1', // Event's ID (required)
            name: "Finding The Person Called Me", // Event name (required)
            date: "January/1/2020", // Event date (required)
            description:"test event of finding the person called me",
            type: "Public Meeting", // Event type (required)
            everyYear: false // Same event every year (optional)
          }
    $query = "SELECT * FROM calendar";
//GET RESULT
    $result = $pdo->query($query);
    $result->setFetchMode(PDO::FETCH_ASSOC);
    while($row = $result->fetch()){
       echo '{';
       echo 'id:'.'"'.rand(100,1000).'",';
       echo 'name:'.'"'.$row['eventname'].'"'.',';
        echo 'date:'.'["'.$row['eventdate'].'"],';
        echo 'color:'.'"#00aba9"';
        echo'},';
    }
?>
    ]
  });
It doesn't work.
