轮训方式后台通知


<div type="button" id="notice" data-toggle="modal" data-target=".bs-example-modal-lg" style="width:0;height:0;">div>
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog modal-sm">
        <div class="modal-content alert-success" style="font-size:16px;line-height:50px;padding:0 20px;text-align:center;">
            <i class="glyphicon glyphicon-volume-up">i>  <div id="msg">div>
        div>
    div>
div>
<audio id="audio" src="__STATIC__/notice.mp3" preload="auto" style="display:none;">audio>
var audio = $("#audio")[0];
        var time = 0;
        $(document).ready(function(){
            settime();
        });
        function settime(){
            if(time == 60){
                notice();
                time = 0;settime();
            }else{

                setTimeout(function(){time++;settime();},1000);
            }
        }
        function notice(){
            $.ajax({
                type:'post',
                url:"{:url('index/notice')}",
                dataType:'json',
                data:{},
                success:function(json){
                    if(json.success == 1){
                        $('#msg').html(json.message)
                        notice_window();
                    }else{
                        $('#msg').html('')
                    }
                },
                error:function(){

                }
            });
        }
        function notice_window(){
            $('#notice').click();audio.play();setTimeout(function(){$('#notice').click();},10000);
        }

你可能感兴趣的:(php)