title: Display notification only once - PHP - Codeigniter - JS
body: <p>There is an ajax function, which displays a notification on the <code>home</code> page, however, every time I enter the<code>home</code> page, or refresh the <code>F5</code> page, the notification is displayed again.</p>
  
  <p>How to fix this?</p>
  
  <p>Is there any way to do this, using <code>js jquery</code> or <code>PHP</code>?</p>
  
  <p>Below the code I have:</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>public function get_message()
  {
      $notification= array();
      $notification['message'] = 'message test';
      $notification['type'] = 1;
      echo json_encode($notification);
  }
  </code></pre>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>/*** variable ***/
  var enum_toastr_type = {
      success: 1,
      info: 2,
      warning: 3,
      error: 4
  }
  /*** PageLoad start ***/
  $(document).ready(function() {
  toastr.options = {
      closeButton: true,
      positionClass: 'toast-bottom-right',
      timeOut: '20000'
  }
     get_message_ajax();
  });
  /*** PageLoad end ***/
  function show_message_toastr(mensagens) {
  $(mensagens).each(function() {
      switch (this.tipo) {
          case enum_toastr_type.info:
              toastr.info(this.message);
              break;
          case enum_toastr_type.success:
              toastr.success(this.message);
              break;
          case enum_toastr_type.warning:
              toastr.warning(this.message);
              break;
          case enum_toastr_type.error:
              toastr.error(this.message);
              break;
      }
  });
  }
  /*** Ajax start ***/
  function get_message_ajax() {
      $.ajax({
          type: 'GET',
          async: false,
          contentType: 'application/json; charset=utf-8',
          url: "helper/get_message",
          success: (function(data) {
               //console.log(data);
               _obj = JSON.parse(data);
              show_message_toastr(_obj);
           }),
          error: (function(erro) {
               handle_ajax_error(erro);
          })
      });
  }
  /*** Ajax end ***/
  </code></pre>