framework/web/View.php
public function renderAjax($view, $params = [], $context = null)
    {
        $viewFile = $this->findViewFile($view, $context);

        ob_start();
        ob_implicit_flush(false);

        $this->beginPage();
        $this->head();
        $this->beginBody();
        echo $this->renderFile($viewFile, $params, $context);
        $this->endBody();
        $this->endPage(true);

        return ob_get_clean();
    }
public function renderAjax($view, $params = [], $context = null)
    {
        $viewFile = $this->findViewFile($view, $context);

        ob_start();
        ob_implicit_flush(false);

        $this->beginPage();
        $this->head();
        $this->beginBody();
        echo $this->renderFile($viewFile, $params, $context);
        $this->endBody();
        $this->endPage(true);

        return ob_get_clean();
    }
Renders a view in response to an AJAX request.

This method is similar to [[render()]] except that it will surround the view being rendered
with the calls of [[beginPage()]], [[head()]], [[beginBody()]], [[endBody()]] and [[endPage()]].
By doing so, the method is able to inject into the rendering result with JS/CSS scripts and files
that are registered with the view.

@param string $view the view name. Please refer to [[render()]] on how to specify this parameter.
@param array $params the parameters (name-value pairs) that will be extracted and made available in the view file.
@param object $context the context that the view should use for rendering the view. If null,
existing [[context]] will be used.
@return string the rendering result
@see render()