code: protected function renderBodyEndHtml($ajaxMode)
      {
          $lines = [];
  
          if (!empty($this->jsFiles[self::POS_END])) {
              $lines[] = implode("\n", $this->jsFiles[self::POS_END]);
          }
  
          if ($ajaxMode) {
              $scripts = [];
              if (!empty($this->js[self::POS_END])) {
                  $scripts[] = implode("\n", $this->js[self::POS_END]);
              }
              if (!empty($this->js[self::POS_READY])) {
                  $scripts[] = implode("\n", $this->js[self::POS_READY]);
              }
              if (!empty($this->js[self::POS_LOAD])) {
                  $scripts[] = implode("\n", $this->js[self::POS_LOAD]);
              }
              if (!empty($scripts)) {
                  $lines[] = Html::script(implode("\n", $scripts));
              }
          } else {
              if (!empty($this->js[self::POS_END])) {
                  $lines[] = Html::script(implode("\n", $this->js[self::POS_END]));
              }
              if (!empty($this->js[self::POS_READY])) {
                  $js = "jQuery(function ($) {\n" . implode("\n", $this->js[self::POS_READY]) . "\n});";
                  $lines[] = Html::script($js);
              }
              if (!empty($this->js[self::POS_LOAD])) {
                  $js = "jQuery(window).on('load', function () {\n" . implode("\n", $this->js[self::POS_LOAD]) . "\n});";
                  $lines[] = Html::script($js);
              }
          }
  
          return empty($lines) ? '' : implode("\n", $lines);
      }
docs: Renders the content to be inserted at the end of the body section.
  The content is rendered using the registered JS code blocks and files.
  @param bool $ajaxMode whether the view is rendering in AJAX mode.
  If true, the JS scripts registered at [[POS_READY]] and [[POS_LOAD]] positions
  will be rendered at the end of the view like normal scripts.
  @return string the rendered content