menu notification auto refresh issue : this code i use to show menu and its notification, but my prob is new msg notification not come before pare reload, i want to auto reload this part to show new msg notification

      <li>
        <a href="#" onclick="initChat(0); return false;">
          <i class="linea linea-basic-message-txt"></i>
          <span><?=$system->translate('Messages')?></span>
          <?=$my_user->NotificationCount('messages')?>
        </a>
      </li>