Implementing chartjs online

Hello how can i fix chartjs it run perfectly on my localhost but when i put it online it doesn’t ?How can i fix this your help is much appreciated

The code run perfectly in the localhost but when uploaded online the bar doesnt appear or the chart doesnt work

Here is the code

            $con = new mysqli('localhost','root','','evaluatordb');
            $query = $con->query("
            SELECT strand, COUNT(*) as total
            FROM rank
            GROUP BY strand;
            ");

        foreach($query as $data)
        {
            $strand[] = $data['strand'];
            $total[] = $data['total'];
        }
        <select onchange="location = this.value;">
        <option value="superadmin.php?q=12">Strand</option>
        <option value="superadmin.php?q=10">Gender</option>
        <option value="superadmin.php?q=11">Age</option>
        
       </select>

       <canvas id="myChart3"></canvas>
       </div>
    }
    

    <script>
        // === include 'setup' then 'config' above ===
        const labels = <?php echo json_encode($strand) ?>;
        const data = {
            labels: labels,
            datasets: [{
            label: 'Strand',
            data: <?php echo json_encode($total) ?>,
            backgroundColor: [
                'rgba(255, 99, 132, 0.5)',
                'rgba(255, 159, 64, 0.5)',
                'rgba(255, 205, 86, 0.5)',
                'rgba(75, 192, 192, 0.5)',
                'rgba(54, 162, 235, 0.5)',
                'rgba(153, 102, 255, 0.5)',
                'rgba(201, 203, 207, 0.5)'
            ],
            borderColor: [
                'rgb(255, 99, 132)',
                'rgb(255, 159, 64)',
                'rgb(255, 205, 86)',
                'rgb(75, 192, 192)',
                'rgb(54, 162, 235)',
                'rgb(153, 102, 255)',
                'rgb(201, 203, 207)'
            ],
            borderWidth: 2
            }]
        };

        const config = {
            type: 'bar',
            data: data,
            options: {
            scales: {
                y: {
                beginAtZero: true
                }
            }
            },
        };

        var myChart = new Chart(
            document.getElementById('myChart3'),
            config
        );
        </script>

I try changing the

but it also didn’t work.