微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决在 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 举报,一经查实,本站将立刻删除。