 jQuery(document).ready(function($) {
            // Fetch jobs from the server
            $.ajax({
                url: '/wp-json/job-scheduler/v1/get_jobs',
                method: 'GET',
                success: function(data) {
                    const tbody = $('#jobTableBody');
                    data.forEach(job => {
                        const row = `<tr>
                             <td>${job.id}</td>
                            <td>${job.channel_name}</td>
                            <td>${job.description}</td>
                            <td>${job.scheduler_stop_job_id}</td>
                            <td><button class="btn btn-primary trigger-btn" data-job-id="${job.scheduler_stop_job_id}">Trigger stop</button></td>
                        </tr>`;
                        tbody.append(row);
                    });

                    // Add click event to trigger buttons
                    $('.trigger-btn').on('click', function() {
                        const jobId = $(this).data('job-id');
                        $.ajax({
                            url: 'https://koravip.com/trigger_job',  // Replace with your Flask app URL
                            method: 'POST',
                            contentType: 'application/json',
                            data: JSON.stringify({ job_id: jobId }),
                            success: function(response) {
                                console.log(response.message);
                            },
                            error: function(xhr) {
                                console.log('Error: ' + xhr.responseJSON.message);
                            }
                        });
                    });
                },
                error: function(xhr) {
                    console.log('Error fetching jobs: ' + xhr.responseJSON.message);
                }
            });
        });