Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
103 - 1
<ul class="nav navbar-nav" id="alert_noti_sec">
2
    <li class="dropdown">
3
    	<a href="#" class="dropdown-toggle" data-toggle="dropdown">
4
    		<i class="fas fa-bell" style="font-size: 16px;"></i>
5
    		<span class="count" style="display: none;"></span>
6
    	</a>
7
    	<ul class="dropdown-menu dropdown-menu-right"></ul>
8
    </li>
9
</ul>
10
 
11
<script>
12
$(document).ready(function(){
13
 
14
    // updating the view with notifications using ajax
15
    function load_unseen_notification(view = '') {
16
    	$.ajax({
17
            url:"alerts.php",
18
            method:"POST",
19
            data:{view: view, 'sec': 'fetch_alerts'},
20
            dataType:"json",
21
            success:function(data) {
22
                if (view != 'yes') {
23
    				$('.dropdown-menu').html(data.notification);
24
                }
25
 
26
       			if(data.unseen_notification > 0) {
27
       				$('.count').show();
28
    				$('.count').html(data.unseen_notification);
29
       			}
30
      		}
31
    	});
32
    }
33
 
34
    load_unseen_notification();
35
 
36
    $('.dropdown').on('shown.bs.dropdown', function () {
37
    	$('.count').html('');
38
    	$('.count').hide();
39
    	load_unseen_notification('yes');
40
    })
41
 
42
    setInterval(function() {
43
       load_unseen_notification();;
44
    }, 100000);
45
 
46
});
47
</script>