public function render($view = null, $layout = null) {
		$dataToSerialize = [
			'error' => null,
			'content' => null,
		];

		if (!empty($this->viewVars['error'])) {
			$view = false;
		}

		if ($view !== false && !isset($this->viewVars['_redirect']) && $this->_getViewFileName($view)) {
			$dataToSerialize['content'] = parent::render($view, $layout);
		}

		$this->viewVars = Hash::merge($dataToSerialize, $this->viewVars);

		if (isset($this->viewVars['_serialize'])) {
			$dataToSerialize = $this->_dataToSerialize($this->viewVars['_serialize'], $dataToSerialize);
		}

		return $this->_serialize($dataToSerialize);
	}
public function render($view = null, $layout = null) {
		$dataToSerialize = [
			'error' => null,
			'content' => null,
		];

		if (!empty($this->viewVars['error'])) {
			$view = false;
		}

		if ($view !== false && !isset($this->viewVars['_redirect']) && $this->_getViewFileName($view)) {
			$dataToSerialize['content'] = parent::render($view, $layout);
		}

		$this->viewVars = Hash::merge($dataToSerialize, $this->viewVars);

		if (isset($this->viewVars['_serialize'])) {
			$dataToSerialize = $this->_dataToSerialize($this->viewVars['_serialize'], $dataToSerialize);
		}

		return $this->_serialize($dataToSerialize);
	}
public function render ( $ view = null , $ layout = null ) { $ dataToSerialize = [ 'error' => null , 'content' => null , ] ; if ( ! empty ( $ this -> viewVars [ 'error' ] ) ) { $ view = false ; } if ( $ view !== false && ! isset ( $ this -> viewVars [ '_redirect' ] ) && $ this -> _getViewFileName ( $ view ) ) { $ dataToSerialize [ 'content' ] = parent :: render ( $ view , $ layout ) ; } $ this -> viewVars = Hash :: merge ( $ dataToSerialize , $ this -> viewVars ) ; if ( isset ( $ this -> viewVars [ '_serialize' ] ) ) { $ dataToSerialize = $ this -> _dataToSerialize ( $ this -> viewVars [ '_serialize' ] , $ dataToSerialize ) ; } return $ this -> _serialize ( $ dataToSerialize ) ; }
Renders an AJAX view.
The rendered content will be part of the JSON response object and
can be accessed via response.content in JavaScript.

If an error has been set, the rendering will be skipped.

@param string|null $view The view being rendered.
@param string|null $layout The layout being rendered.
@return string The rendered view.
Renders an AJAX view . The rendered content will be part of the JSON response object and can be accessed via response . content in JavaScript .