Browse Source

update ajax notifications in menu.tpl

Alex Aragón 6 years ago
parent
commit
a08ec978ec
1 changed files with 3 additions and 2 deletions
  1. 3 2
      main/template/default/layout/menu.tpl

+ 3 - 2
main/template/default/layout/menu.tpl

@@ -3,11 +3,12 @@
     <script>
     <script>
         $(document).ready(function () {
         $(document).ready(function () {
             $.get('{{ _p.web_main }}inc/ajax/message.ajax.php?a=get_count_message', function(data) {
             $.get('{{ _p.web_main }}inc/ajax/message.ajax.php?a=get_count_message', function(data) {
-                if (data === '0') {
+                var countNotifications = (data.ms_friends + data.ms_groups + data.ms_inbox);
+                if (countNotifications === 0 ) {
                     $("#count_message_li").addClass('hidden');
                     $("#count_message_li").addClass('hidden');
                 } else {
                 } else {
                     $("#count_message_li").removeClass('hidden');
                     $("#count_message_li").removeClass('hidden');
-                    $("#count_message").append(data);
+                    $("#count_message").append(countNotifications);
                 }
                 }
             });
             });
         });
         });