在 Fat free 框架中使用 Ajax 每 5 秒渲染一次路由

问题描述

我需要脱脂帮助
我想每 5 秒使用 ajax 渲染到特定路线
但我无法在 ajax 页面中控制任何数据

这是我的 PHP 代码

elseif ($this->session->isRole(UserRole::TRAINEE)) {

                    $this->assets->addJs('meeting.js');
                    $f3->push('init.js','Meetings');
                    $f3->set('name',$name);
                    
                    $f3->set('joinUrl','meeting/' . $meetingId);

                    $this->render();
                }

这是我的ajax代码

let Meetings = function () {

 let joinMeeting = function () {
    $(document).on('click','.join-meeting',function (e) {
        e.preventDefault();

        let meetingId = data.meeting_id;

        $.ajax({
            type: 'GET',url: '/meeting/' + meetingId,contentType: 'application/json',success: function (result) {
                if (result.joinUrl === 'none') {
                    noty({text: 'Could not join the requested meeting.',type: 'error'});
                } else {
                    setInterval(window.open(result.joinUrl,'_blank'),5000);
                }
            },error: function (jqXHR) {
                noty({text: 'Application error',type: 'error'});
            }
        });
    });
};


return {
    //main function to initiate the module
    init: function () {
        joinMeeting();

    }
}
}();

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)